jben Posted April 16, 2008 Share Posted April 16, 2008 Hi everyone. I'm using some code that will allow me to set the %cdrom% variable. This works, however if I use it on a PC with memory card readers then I get errors, which state the disk is not accesible.Anyone have any ideas how to get around this?. Thanksecho offfor %%a in (a b c d e f g h i) do ( if exist %%a:\Known.File ( SET CDROM=%%a: ))echo %CDROM%pause Link to comment Share on other sites More sharing options...
fairyprincess Posted April 16, 2008 Share Posted April 16, 2008 Could do as described http://www.msfn.org/board/Bat-file-help-t115393.htmlModify Yzöwl's code to check for CD-ROMS@Echo off&Setlocal enableextensionsFor /f %%# In ('Mountvol^|Findstr [d-z]:\\') Do ( Fsutil fsinfo drivetype %%#|Find "CD-ROM Drive">Nul&&( If Exist %%#KNOWNFILE Set "CDROM=%%~d#"))If defined CDROM Echo:%%CDROM%%=%CDROM% Link to comment Share on other sites More sharing options...
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