Jump to content

Get CDROM error


Recommended Posts

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?. Thanks

echo off

for %%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


Could do as described http://www.msfn.org/board/Bat-file-help-t115393.html

Modify Yzöwl's code to check for CD-ROMS


@Echo off&Setlocal enableextensions
For /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

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...