Computer Hope
Microsoft => Microsoft DOS => Topic started by: mcolli00 on April 21, 2009, 09:28:58 AM
-
I have a batch file that mounts a drive and runs various scripts on a network drive. Once the scripts completes the drive automatically unmounts. If the user clicks the exit button on the dos window I would like to unmount the drive. Do you know how unmount a drive if the user exits the batch operation? Thanks MC
IF EXIT popd \\mynetwork
-
Why don't you just run the batch file in the background so user can't exit it by closing the prompt? Or do I not understand the problem?
-
This is not possible if you mean "DOS" in Windows, since that is actually CMD.
You can't unmount a drive in CMD.
-
I have the mounting and unmounting working fine. Users test the scripts so they are allowed the flexibility to kill a batch if needed.
I just wanted to know if you can use
if Exit then do something...
-
Oh i see what your using, Popd, haven't seen that in a while.
And no you can't check to see if the batch file closes then do something, it's not possible in batch.
-
Alrighty thanks :-)
-
you can compile somebatfile.bat to someexefile.exe wich will create subbatfile.bat. That subbatfile.bat will check if that compiled someexefile.exe is running or no ;D
-
yes, but if he means run whatever commands on program termination then thats not possible.