1.

Solve : How to - If user clicks EXIT then unmount (popd) network drive?

Answer»

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 yes, but if he means run whatever COMMANDS on program termination then thats not possible.



Discussion

No Comment Found