Solved

Tell a batch file what letter the CD-ROM drive is?

Posted on 2004-09-13
6
243 Views
Last Modified: 2009-12-16
I'm trying to setup a batch file to run multiple programs from a CD.  This CD is being used for Spyware removal when the CD is inserted into the computer.  Currently, the batch file only works with the "D" drive but I would like to have this figure out what the drive letter designation for the CD-ROM drive that I have inserted the disk into and then pass that along to the batch file and run all of the programs in succession.  This is a collaboration between myself and another gent ( I wanted to give credit where credit is due ) and this is the only roadblock that we have run into right now.

The code of the batch file is:

d:
start /wait lspfix.exe
start /wait aaw6181.exe
copy reflist.ref C:\Progra~1\Lavasoft\Ad-awa~1
start /wait spybotsd13.exe /silent /nocancel /components="main"
mkdir C:\Progra~1\Utilit~1\
copy CWShredder.exe C:\Progra~1\Utilit~1\
copy HijackThis.exe C:\Progra~1\Utilit~1\
copy hsremove.exe C:\Progra~1\Utilit~1\
copy Kill2Me.exe C:\Progra~1\Utilit~1\
mkdir "%ALLUSERSPROFILE%\Start Menu\Programs\Utilities"
shortcut /f:"%ALLUSERSPROFILE%\Start Menu\Programs\Utilities\CWShredder.lnk" /a:c /t:c:\Progra~1\Utilit~1\CWShredder.exe
shortcut /f:"%ALLUSERSPROFILE%\Start Menu\Programs\Utilities\HijackThis.lnk" /a:c /t:c:\Progra~1\Utilit~1\HijackThis.exe
shortcut /f:"%ALLUSERSPROFILE%\Start Menu\Programs\Utilities\hsremove.lnk" /a:c /t:c:\Progra~1\Utilit~1\hsremove.exe
shortcut /f:"%ALLUSERSPROFILE%\Start Menu\Programs\Utilities\Kill2Me.lnk" /a:c /t:c:\Progra~1\Utilit~1\Kill2Me.exe
shortcut /f:"%ALLUSERSPROFILE%\Start Menu\Programs\Utilities\Spybot.lnk" /a:c /t:C:\Progra~1\Spybot~1\spybotsd.exe
shortcut /f:"%ALLUSERSPROFILE%\Start Menu\Programs\Utilities\Ad-aware.lnk" /a:c /t:C:\Progra~1\Lavasoft\Ad-awa~1\Ad-aware.exe
rd /s/q "%ALLUSERSPROFILE%\Start Menu\Programs\Spybot - Search & Destroy"
del /q "%USERPROFILE%\Start Menu\Programs\Ad-aware 6.lnk"
rd /s/q "%USERPROFILE%\Start Menu\Programs\Lavasoft Ad-aware 6"
c:
cd C:\Progra~1\Spybot~1
start /wait spybotsd.exe /autoupdate /autocheck /autofix /autoclose
cd C:\Progra~1\Utilit~1\
start /wait CWShredder.exe
start /wait hsremove.exe
start /wait Kill2Me.exe
start /wait HijackThis.exe
cd C:\Progra~1\Lavasoft\Ad-awa~1
start /wait Ad-aware.exe

As you can see, we are using a host of files on the CD to clean up a computer quite quickly and without much user intervention other than clicking "next, next, next, finish" and so on.  

Is there a way to add this functionality to this or would it have to be written as a vbscript of wscript file to be able to do this?

Thanks,

Mike Stevens

P.S.  I'm new to the points thing so please bear with me.  

0
Comment
Question by:mstevens23
6 Comments
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 150 total points
ID: 12043289
Perhaps something here will help you:
http:Q_10175070.html
http:Q_10083817.html
http:Q_10480178.html
0
 
LVL 55

Expert Comment

by:Julian Hansen
ID: 12043972
Is there a reason you have to specify a drive at all? What I mean is if you run the batch file from the CD drive it should all be relative to that drive.

Alternatively you could always pass it in as a parameter

go.bat E:

--- GO.BAT
%1
REM rest of bat file
-- END GO.BAT

0
 
LVL 19

Assisted Solution

by:RanjeetRain
RanjeetRain earned 50 total points
ID: 12044744
Nothing much is required. You just need to remove that first line from your batch file and you will be pretty much okay.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Accepted Solution

by:
itcnbwise earned 50 total points
ID: 12044880
julianH has it right - pass it as a parameter, since you say there's another program which can pass the drive letter.
0
 

Author Comment

by:mstevens23
ID: 12181075
Thanks for all the help with this question.  The first answer is mainly the one that answered my question and pointed me in the direction I needed to be.  

As I stated before I'm new to the "points thing" so if I missed anyone, please accept my apologies.  

Thanks very much for all of your help.

Mike Stevens
0
 
LVL 55

Expert Comment

by:Julian Hansen
ID: 12181208
but ... but ... but ... <sigh> oh well ...
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question