Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. @REM I created this small utility script, to map on-demand my network drive
  2. @REM that I have on my Windows 7 machine.
  3. @REM The network drive is from a virtual machine, that has a static IP assigned.
  4. @REM
  5. @REM Note:
  6. @REM This does not use the persistent setting, because my VM does not start automatically
  7. @REM at boot time, and sometimes it might also be down, and mapping it as persistent will
  8. @REM result in Windows freezing or delaying the start-up, while waiting to map/mount
  9. @REM a network drive that does not exist.
  10. @REM ----------
  11. @REM (OPTIONAL STEP)
  12. @REM First, if the machine requires login credentials, set them.
  13. @REM @REMove or comment the below line if your network drive does not require login.
  14. @REM My network drive is located at 192.168.140.128 with u/p Mike:mike
  15. @REM The target, that this sets the credentials for, is then 192.168.140.128 (the IP of my VM)
  16.  
  17. cmdkey /add:192.168.140.128 /user:Mike /pass:mike
  18.  
  19. @REM You can always check the credentials set, by issuing:
  20. @REM cmdkey /list
  21. @REM ----------
  22. @REM (MAPPING STEP)
  23. @REM Map the network drive (assuming it's available), also specifying username and password
  24. @REM so that the mount is faster. You can ommit the username and password, if you've already
  25. @REM run the cmdkey to add credentials for the target, but it might take a few seconds for
  26. @REM net to check with the credentials manager. As such, I always add it here to,
  27. @REM to make it mount faster.
  28. @REM Below I will map /code on my VM located at 192.168.140.128 to driver letter Y
  29.  
  30. net use y: \\192.168.140.128\code /u:Mike mike
  31.  
  32. @REM That's it. Now all I have to do after booting up the VM is to double-click this bat file.
  33. @REM for additional info: `net help use`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement