Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @REM I created this small utility script, to map on-demand my network drive
- @REM that I have on my Windows 7 machine.
- @REM The network drive is from a virtual machine, that has a static IP assigned.
- @REM
- @REM Note:
- @REM This does not use the persistent setting, because my VM does not start automatically
- @REM at boot time, and sometimes it might also be down, and mapping it as persistent will
- @REM result in Windows freezing or delaying the start-up, while waiting to map/mount
- @REM a network drive that does not exist.
- @REM ----------
- @REM (OPTIONAL STEP)
- @REM First, if the machine requires login credentials, set them.
- @REM @REMove or comment the below line if your network drive does not require login.
- @REM My network drive is located at 192.168.140.128 with u/p Mike:mike
- @REM The target, that this sets the credentials for, is then 192.168.140.128 (the IP of my VM)
- cmdkey /add:192.168.140.128 /user:Mike /pass:mike
- @REM You can always check the credentials set, by issuing:
- @REM cmdkey /list
- @REM ----------
- @REM (MAPPING STEP)
- @REM Map the network drive (assuming it's available), also specifying username and password
- @REM so that the mount is faster. You can ommit the username and password, if you've already
- @REM run the cmdkey to add credentials for the target, but it might take a few seconds for
- @REM net to check with the credentials manager. As such, I always add it here to,
- @REM to make it mount faster.
- @REM Below I will map /code on my VM located at 192.168.140.128 to driver letter Y
- net use y: \\192.168.140.128\code /u:Mike mike
- @REM That's it. Now all I have to do after booting up the VM is to double-click this bat file.
- @REM for additional info: `net help use`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement