I have batch files with the construct:
if exist F:\ copy /y Application.exe F:\
at the end of a compile, to copy the executable to a USB key if it is plugged in. It has worked fine with USB keys but when I had a USB multi card reader plugged in (this looks like drives E:..H:, and if there is no SD card plugged in, when I execute the above batch line, I get a "Windows - no disk" snag message.
If there is a card plugged in, I don't get the message, (and the file is copied), if the card reader is not plugged in, I don't get the message and the file is not copied (obviously), but in neither of these cases does the batch file stop running. It's only if the card reader is plugged in but there is no card in the drive.
Can I check quietly for no "disk" in these USB drives from a batch file?
if not exist F:\ echo hello
displays a dialog--------------------------- Windows - No Disk --------------------------- Exception Processing Message c0000013 Parameters 75b6bf7c 4 75b6bf7c 75b6bf7c --------------------------- Cancel Try Again Continue ---------------------------
if F:\ refers to a USB card reader with no card plugged in, whereas usingDIR F:\ 1>NUL 2>&1 || echo hello
just echoshello
like it should. – Austria