Jump to content

setting cd-rom drive varible


Recommended Posts

IF EXIST D:\AUTORUN.INF set CDROM=D:
IF EXIST E:\AUTORUN.INF set CDROM=E:
IF EXIST F:\AUTORUN.INF set CDROM=F:
IF EXIST G:\AUTORUN.INF set CDROM=G:
IF EXIST H:\AUTORUN.INF set CDROM=H:
IF EXIST I:\AUTORUN.INF set CDROM=I:
IF EXIST J:\AUTORUN.INF set CDROM=J:
IF EXIST K:\AUTORUN.INF set CDROM=K:
IF EXIST L:\AUTORUN.INF set CDROM=L:
IF EXIST M:\AUTORUN.INF set CDROM=M:
IF EXIST N:\AUTORUN.INF set CDROM=N:
%CDROM%
pause

1) If you run this batch with your original commands with a cdrom in a drive, it works.

2) You do not use the cdrom variable within your script.

So no problem showing with the script shown, that I can see. Why set the cdrom variable? Not needed.

Link to comment
Share on other sites


The CDROM variable is is limited to within the script. It will not be available for use by WPI as set by this script. WPI needs a routine within itself for setting a CDROM variable.

Link to comment
Share on other sites

well thankyou very much this will be helpful but one thing i have left to ask is if i open a cmd batch file from wpi will the cdrom varible still work or will i ahve to modify all these cmds somehow

BTW in WPI if i have a 2nd cmd setup does that wait for the first one to finish

Link to comment
Share on other sites

If you create a cmd batch file from WPI that will access the CDROM, you will need to set a CDROM variable within that script.

Consider the CDROM variable as only a local variable.

Use Start /Wait for programs in command files to stop following being executed.

Link to comment
Share on other sites

Well i have numerous scripts like this to run the setups and kill processes or add regkeys after the setup

@echo off
title Installing MSN Messenger Plus

start /wait %cdrom%\install\Applications\msnplus\6\MsgPlus-325.exe /SilentInstallNoSponsor
%cdrom%\install\Applications\msnplus\pskill.exe msnmsgr.exe
%cdrom%\install\Applications\msnplus\pskill.exe msgplus.exe
exit

how would i make this into a full WPI script thing

Link to comment
Share on other sites

I am not really familar with WPI commands. It would be best to use the WPI commands. Otherwise, each of those scripts would need a cdrom set routine.

e.g.

@echo off
title Installing MSN Messenger Plus

IF EXIST D:\AUTORUN.INF set CDROM=D:
IF EXIST E:\AUTORUN.INF set CDROM=E:
IF EXIST F:\AUTORUN.INF set CDROM=F:
IF EXIST G:\AUTORUN.INF set CDROM=G:
IF EXIST H:\AUTORUN.INF set CDROM=H:
IF EXIST I:\AUTORUN.INF set CDROM=I:
IF EXIST J:\AUTORUN.INF set CDROM=J:
IF EXIST K:\AUTORUN.INF set CDROM=K:
IF EXIST L:\AUTORUN.INF set CDROM=L:
IF EXIST M:\AUTORUN.INF set CDROM=M:
IF EXIST N:\AUTORUN.INF set CDROM=N:

start /wait %cdrom%\install\Applications\msnplus\6\MsgPlus-325.exe /SilentInstallNoSponsor
%cdrom%\install\Applications\msnplus\pskill.exe msnmsgr.exe
%cdrom%\install\Applications\msnplus\pskill.exe msgplus.exe
exit

A lot of copy and pasting into all script needed.

Link to comment
Share on other sites

@echo off
title Installing MSN Messenger Plus
for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\Autorun.inf set CDROM=%%a:
start /wait %cdrom%\install\Applications\msnplus\6\MsgPlus-325.exe /SilentInstallNoSponsor
%cdrom%\install\Applications\msnplus\pskill.exe msnmsgr.exe
%cdrom%\install\Applications\msnplus\pskill.exe msgplus.exe
exit

This style looks better though

Edit: If your software is on the cd in install\Applications... , why not have these batch files in install\Applications, and use relative addressing?

WPI will have the cdrom variable so you just call the batches on the cd.

Link to comment
Share on other sites

Hey un4given1 ;)

I don't mean to gloat, but yes, I do see that both of us try to help people, and ask them to search when its relevant!

(pun intended...  I'm referring to what you'd said about too many people responding with "search" instead of the answer)

I did that on purpose ;)

Link to comment
Share on other sites

Here A script That Will Run From Any Where And Pass The Varibles

The Only Down side it seems is it cant handle spaces in the names

I tried quotes but was not able to get it to work with spaces.

So make Sure There no Space In The script.

Purple That A Test Of A Install I Did With This EDIT TO YOUR NEEDS

Red Means You Can delete

Orange Is The Test Of The Cmd

Blue Is the Clean Up Part

echo off

cls

mode con: cols=55 lines=4

color 5f

TITLE PSP 9 PRO INSTALL

SET L1=%~dp0TESTLOC1\

MKDIR "%L1%"

ECHO TEST LOCATION 001 > %L1%TSTLOC1.TXT

ECHO MESSAGE TEST 1 >> %L1%TSTLOC1.TXT

ping -n 1 127.0.0.1>nul

goto WORK

:WORK

if EXIST  "%~dp0\TESTLOC1\TSTLOC1.TXT" (SET CD=%~dp0TESTLOC1\)

::::::::::::::::::::::::::::EDIT THIS BELOW AND IT WILL RUN THE INSTALL

::" )echo off

::" )cls

::" )mode con: cols=55 lines=4

::" )color 5f

::" )TITLE MicroAngelo57 INSTALL

::" )SET CD=%~dp0MicroAngelo\

::" )if EXIST  "%~dp0\Install\MicroAngelo\MicroAngelo57.exe" (SET CD=%~dp0Install)

::" )

::  start %CD%\MicroAngelo\MicroAngelo57.exe /S /QN)

::" )

::ping -n 1 127.0.0.1>nul

::SET CD1=%CD%\MicroAngelo\

::ECHO YOUR LOCATION IS:

::SET /P = %CD1%

::::::::::::::::::::::::::::EDIT THIS ABOVE AND IT WILL RUN THE INSTALL

ECHO YOUR LOCATION IS:

SET /P = %cd%

> CU1.vbs echo Dim Garbage

>> CU1.vbs echo set Garbage = (CreateObject("Scripting.FileSystemObject"))

>> CU1.vbs echo msgbox "Starting Clean UP?",vbokonly+48,"Clean Up"

>> CU1.vbs echo Garbage.Deletefile ("%cd%TSTLOC1.TXT")

>> CU1.vbs echo Garbage.DeleteFile ("\CU1.vbs")

>> CU1.vbs echo wscript.sleep 500

>> CU1.vbs echo Delete=("%cd%TSTLOC1.TXT")

>> CU1.vbs echo Delete=("\CU1.vbs")

>> CU1.vbs echo wscript.sleep 500

>> CU1.vbs echo msgbox "Clean UP Completed?",vbokonly+48,"Clean Up Those Files"

start /w CU1.vbs

rmdir %cd%

set /p = Press Key To Close

I made This A self Extracting Rar To Be able To Run From The Link

The Cmd Will Be Located In %systemdrive%

Edited by gunsmokingman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...