I need to check if a drive (Z:) is in use (e.g. in use by an application, opened).
My Batch File looks like this:
Mount Z:
wait 15 minutes
check if drive Z: is in use
IF NOT: unmount Z:
ELSE: wait 15 minutes
repeat..
Is there any Command for this? Thanks!
Use the IF EXIST or IF NOT EXIST combination:
:FindDrive
if exist Z:\nul goto Mounted
timeout /T 5
goto FindDrive
:Mounted
NUL is the a 'virtual' file that exists in every folder. So if c:\anypath\nul exists, the drive exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With