Jump to content

Need some help with batch

Joveice

Hi, I need some help with a batch file

The code I use is this:

    @echo off
   setLocal Enabledelayedexpansion


for %%d in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
  if exist %%d:\ (
     ECHO Device Found : %%d
  )
)

I need it to only post out CD drives or DVD.

So etc, D is a CD drive, it will then only say D

Back-end developer, electronics "hacker"

Link to comment
Share on other sites

Link to post
Share on other sites

so you want the script to check if the drive is a Dvd drive and then write the letter if found?

 

I'm not sure you can do this, but you could maybe try writing to each drive, an empty drive would fail where as a disk drive would not.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

38 minutes ago, vorticalbox said:

so you want the script to check if the drive is a Dvd drive and then write the letter if found?

 

I'm not sure you can do this, but you could maybe try writing to each drive, an empty drive would fail where as a disk drive would not.

Yea, And I could try that

Back-end developer, electronics "hacker"

Link to comment
Share on other sites

Link to post
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

×