If then statement in windows 7 64bit annoying message

bkorn

Honorable
Nov 28, 2012
4
0
10,510
I have a super simple bat file that pretty much looks like this:

if exist d:\*.* echo D is available
if exist e:\*.* echo E is available
if exist f:\*.* echo F is available

It works in XP. It works on MY Win 7 64bit machine.

BUT if I run it on my father-in-lawy's Win7 64bit machine, a system message pops up saying it can't find the drive. If I click Continue, the message persists until I hit Continue multiple times.

Anyone know what is going on here? How do I prevent this message from happening?

Thanks!

Bruce


 
G

Guest

Guest


Does his PC have a D, E, or F drive on it?

Also if any of those are CD drives, if they are empty they will come back as not found.
 



It's the "pretty much" part that's probably causing the problem. Post the entire script.
 



Ran the above script on a system with only a D: drive (CD/DVD, no disc inserted). No output (as expected) and no errors regarding drives not found.
 

djscribbles

Honorable
Apr 6, 2012
1,212
0
11,460
I would expect an SDCard reader is one of the specified drives.

When I tried the script on a card reader (with no card inserted) it threw an error: "Exception Processing Message ..." "Cancel/TryAgain/Continue" (It was however fine for my empty CD-R drive, it may also matter whether the optical drive has write capabilities, since windows lets you cache writes and insert a disk later).

This behavior is probably specific to the device you are checking at each drive letter.
 

bkorn

Honorable
Nov 28, 2012
4
0
10,510
Thank you all for your responses.

Yes..one of the drives IS an SD Card reader.

And Yes, some of the drive letters DO map to CD Drives and whatnot.

For example, if my SD card is inserted, the bat file says E is available, but
if my SD card is removed, the bat file returns nothing about an E drive, which is just what I expect.

All I was trying to do was create a script to tell my father-in-law WHAT drive letters were "available" to him (as they sometimes change)

the real bat file has following line repeated from D to Z

if exist d:\*.* echo D is available

And again..on MY Win7 machine it matters not what the drive is or it's state
(or whether media is inserted or not)

But on my father-in-laws machine I get the aforementioned system error message every time, no matter what.

Oy vey.

I thought their might be some kind of window setting that I could turn off to prevent that message from happening.

Oh well..thank you all regardless!



 

djscribbles

Honorable
Apr 6, 2012
1,212
0
11,460



The issue likely is not windows, but rather the device. It's likely that if you have an SD card reader it responds differently do being poked when it has no media inserted than your father-in-law's. If you don't have an SD card reader, then it maybe that all SD card readers behave that way (mine does).

You can test it by using your card reader on his machine and/or his card reader on your machine.
 

bkorn

Honorable
Nov 28, 2012
4
0
10,510


Oh thank you! I will give this code a try!