I'm currently writing a script that should map a network drive to the letter Z
, i'm using the command net use z: \\path
, the thing is that if the user is already using this letter i won't be able to map it, is there any way to check the existense of this drive (z) and if it exists to unmount it and mount it to a different letter and still use the z
drive which i need for my script, this is a part of an installation, and it should be on Z drive.
Use the MS-DOS "net share" command Click Start, Run, type cmd, and press Enter . At the MS-DOS prompt, type net share and press Enter . Each of the shares, the location of the resource, and any remarks for that share are displayed.
You can check whether the drive is mounted by IF EXIST Z:\
. This should work:
if exist z:\ ( net use z: /delete ) net use z: \\path
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