Solved

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

Posted on 2004-09-13
6
240 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 51

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 51

Expert Comment

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now