4johnny67 Posted May 12, 2005 Posted May 12, 2005 Hi,Is there a command like %systemdrive% but for "Cd-rom drive"?In one of my batch files I hard-coded D: to specify my CD-Rom drive but I would rather not since other systems will not have D: as their Cd-Rom drive.Is there a way to tell the system to look at the CD-ROM Drive and not just a hard-coded drive letter?thanks
Vadikan Posted May 12, 2005 Posted May 12, 2005 http://unattended.msfn.org/advanced/methods/runonceex_cd.htmYou can also search for cdrom in the thread titles. You'll like the results.
Noise Posted May 12, 2005 Posted May 12, 2005 Inside a batch file you can use the %CD% variable for the current working directory. The %CD% variable isnt sugesting CDROM, it's short for Current Directory.The %CDROM% variable works only during the installation phase, if I recall correctly.The %CD% variable only exists in XP and above I believe. What I use in my batch files is the %~dp0 command. Like this:SET MAINDIR=%~dp0ECHO %MAINDIR%To launch a file in the same directory as the batch file use:%~dp0SETUP.EXEYou can also call a file in a relative subdirectory:%~dp0FIREFOX\SETUP.EXENotice the lack of a backslash after %~dp0. %~dp0\SETUP.EXE is incorrect because %~dp0 includes the trailing backslash (although if you put it in on accident it still seems to work).
erik_demon Posted May 13, 2005 Posted May 13, 2005 Hey Check out this post.Here it is shown how to make a permanent variable for your CD drive
Martin Zugec Posted May 13, 2005 Posted May 13, 2005 This (working on XP Pro) will create variable strCdRom with drive letter... If you have more cdrom drives, I can create filter for cdrom name/media loadedfor /f "usebackq delims== tokens=1,2" %i IN (`wmic cdrom get drive /value`) DO set strCdRom=%j
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now