Batch file to map network drive

From ISoft Wiki
Revision as of 15:55, 1 November 2010 by Daytonlowell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

For some unknown reason *cough*gremlins*cough* Windows occasionally decides that it doesn't like mapped network drives, so it will either disconnect them or forget the password for authentication. If you want to avoid this, you can create a batch file that:

  • Deletes the mapped network drive if it has already been created
  • Recreates the mapped network drive
  • And since the batch file is placed in the startup folder, this happens when the computer starts up - theoretically curing you of nework-drive-related headaches.

Here is the code for the batch file:

@echo off
net use <DRIVE LETTER>: /delete
net use <DRIVE LETTER>: "\\<DESTINATION>\<SHARE>" /user:<USER> <PASSWORD> /persistent:yes
exit

Replace:

  • <DRIVE LETTER> with the letter of the Mapped Network Drive
  • <DESTINATION> with the computer you want to set up the mapped network drive on
  • <SHARE> with a shared file on the <DESTINATION> computer
  • <USER> with the username of a valid account that will log you on to the <DESTINATION> computer
  • <PASSWORD> with the password of a valid account that will log you on to the <DESTINATION> computer