Difference between revisions of "Batch file to map network drive"

From ISoft Wiki
Jump to navigationJump to search
(Answer to a sucky problem I fixed)
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
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:
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
* Deletes the mapped network drive if it has already been created
Line 7: Line 7:
Here is the code for the batch file:
Here is the code for the batch file:


<source lang="text">
<source lang="dos">
@echo off
@echo off
net use <DRIVE LETTER>: /delete
net use <DRIVE LETTER>: /delete

Latest revision as of 14:55, 1 November 2010

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