2

I have a few codes here that work but I need something new. I have drive letter detect and if CD Exist in drive batch code

But now I need if is a cd drive batch code and if not do other thing

Codes I Have:

if CD in drive:

@echo off
title CD Test

:main
CLS
WMIC CDROM E: GET MEDIALOADED | FINDSTR "TRUE"
IF %ERRORLEVEL% EQU 0 (
goto one
) ELSE (
goto two
)

If Drive Letter Exist:

@echo off
title If Exist Test

:main
CLS
echo.
echo press any key to see if drive C:\ exists
echo.
pause>nul
IF EXIST C:\ (GOTO yes) ELSE (GOTO no)

There and while both of those are working great I have no idea how to tell if its a cd drive or say NTFS or FAT32 I believe CD drive format if CDFS but im not sure.

So i need a code that will tell me if drive is NTFS/FAT32 or CDFS and goto 1 option or other based on findings.

Or would it be better to just check if drive letter is empty? 0 bytes... Would that effect if say a empty usb was plugged in it could be called a cd drive?

Twml
  • 421
  • 1
  • 4
  • 10
  • Use .net commands http://stackoverflow.com/questions/158359/in-powershell-how-can-i-determine-if-the-current-drive-is-a-networked-drive-or – Gary Kindel Jun 09 '14 at 13:44
  • 1
    `wmic logicaldisk get caption,description,filesystem` – Stephan Jun 09 '14 at 14:12
  • Can I get a full @echo off code please, not just suggestions, Thanks I need to get this working, While the: wmic logicaldisk get caption,description,filesystem does tell what drive is, it doest help me in my batch code that much. – Twml Jun 09 '14 at 17:07
  • `wmic logicaldisk where caption="E:" get description|find "CD">nul && echo it's a CD-Drive || echo It's not`. I'm sure, you're able to add the `@echo off` yourself. – Stephan Jun 09 '14 at 18:07
  • got it to work, and changed it to goto yes || goto nope ... but you got it, thanks – Twml Jun 09 '14 at 19:43

1 Answers1

2
@echo off
title If CD Test

:main
CLS
wmic logicaldisk where caption="E:" get description|find "CD">nul && echo it's a CD-Drive    || echo It's not
pause

There ya go, im sure u just didnt understand how it was formatted in comments It looks better as code in an answer.

Twml
  • 41
  • 4
  • Thanks that exactly what im looking for i just changed the... echo it's a CD with... goto yes || goto nope... other then that exactly what i wanted thanks. – Twml Jun 09 '14 at 19:42