0

I am trying to copy the contents of multiple .iso images to a directory. I created a batch file for this, which mounts the .iso file in Virtual Clone Drive, and then it starts copying. However, Daemon.exe returns before the mounting is finished. I want to continue only once the virtual drive is accessible, so I inserted a loop to wait for it, like this:

"C:\Program Files (x86)\Elaborate Bytes\VirtualCloneDrive\Daemon.exe" -mount "%imagefile%" "%drive%"
:loop
if not exist "%drive%\" (
    sleep 1
    goto :loop
    )
xcopy "%drive%\" "%tempfolder%" /e /h /i /r /y

It does not really work because at the if not exist line a dialog window appears:

cmd.exe - No Disk

There is no disk in the drive. Please insert a disk into drive V:.

Cancel Try Again Continue

This way the batch file does not work automatically because I have to press one of the buttons.

How can I avoid this dialog?

[Update] As Appleoddity pointed out, there is no sleep command in cmd, so I updated the code:

"C:\Program Files (x86)\Elaborate Bytes\VirtualCloneDrive\Daemon.exe" -mount "%imagefile%" "%drive%"
:loop
if not exist "%drive%\" (
    timeout 1 /nobreak > nul
    goto :loop
    )
xcopy "%drive%\" "%tempfolder%" /e /h /i /r /y

[Update] Here are two pictures: before and after pressing the enter to execute vcd.bat. enter image description here enter image description here

0

I cannot reproduce your problem in Windows 10.

@echo off
set drive=F:
"C:\Program Files (x86)\Elaborate Bytes\VirtualCloneDrive\Daemon.exe" -mount "D:\Windows.iso" "%drive%"

:loop
if not exist "%drive%\" (
    echo Drive does not exist
    timeout 1 /nobreak >NUL
    goto :loop
    )
echo Drive Exists

Output:

Drive does not exist
Drive does not exist
Drive Exists

It appears this problem does not exist. The message you are referring to sounds like an old Windows 98 error or something. I was unsuccessful in reproducing any prompt that required input when trying to use this script, regardless of the state of the drive. Perhaps you have not defined %drive% as I have or you have something else on your computer causing the problem, like some anti-virus or something trying to scan the drive when you access it.

  • Yes, I noticed, too that sleep does not exist, so I replaced it with timeout 1 /nobreak > nul – z32a7ul Feb 9 '18 at 21:26
  • As I see, the first line is missing from your script. That one should mount the .iso file. And these .iso files are on a network drive which is relatively slow. What version of VCD do you use? – z32a7ul Feb 9 '18 at 21:31
  • I don’t need to mount an ISO to test this. The drive letter either exists or it does not. And I’m able to show the script works properly in both circumstances. If VCD is making the drive letter available before it is ready, then checking if a drive letter exists is not going to work. – Appleoddity Feb 9 '18 at 21:34
  • Yes, you need. My question is about a special state of VCD, you cannot reproduce it without that software. To draw a simple analogy: Question: The motor of my motorcycle is too noisy, what can I do about it? Answer: I can't hear any noise on my bicycle, so your motorcycle must be OK, too. – z32a7ul Feb 9 '18 at 21:58
  • You’re not understanding the concept here, sorry. The analogy is actually, “Why is my motorcycle hitting so many potholes?” Answer: “I drove down the same road on my bike and didn’t see any potholes.” The script is very simple. Does the drive exist, or does the drive not exist. It doesn’t matter if it is mounted by vcd, usb, CD, hard drive, etc. IF VCD makes the drive available BEFORE it is ready, then your script logic will not work, ever. You will not be able to test for “readiness” by asking if the drive letter exists. Otherwise, it works fine, as I have demonstrated. The road is clear. – Appleoddity Feb 9 '18 at 22:03
0

Maybe someone else is also interested in the problem, so I post how I finally solved the problem:

"C:\Program Files (x86)\Elaborate Bytes\VirtualCloneDrive\Daemon.exe" -mount "%imagefile%" "%drive%"
:loop
vol "%drive%" > nul 2> nul
if not "%errorlevel%" == "0" (
    timeout 1 /nobreak > nul
    goto :loop
    )
xcopy "%drive%\" "%tempfolder%" /e /h /i /r /y

Note: vol normally prints basic information about a drive, since it is not needed, both the output and the debug output is redirected to nul. The important fact is that it does not show a dialog in case of an error but sets the errorlevel environment variable to 1 (or something different from 0), which can be checked to avoid using the if exist construct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.