Site-wide Tags:  Linux(17) | CommandLine(12) | Ubuntu(10) | RemoteAccess(7) | Tools(7) | Vim(7) | LiftWeb(5) | SBT(5) | SoftwareDev(5) | Mac(5) | Scripts(4) | WebDev(4) | Diagrams(4) | Lifty(3) | NetworkDrives(3) | Processwire(3) | Security(3) | Fog(3) | VCS(3) | BestPractices(3) | RaspberryPi(2) | WebDesign(2) | Encryption(2) | Windows(2) | SSH(2) | WinCommandPrompt(2) | GitHubRepos(2) | Emacs(2) | PHP(2) | IDE(2) | ErrorMsgs(2) | JVM(2) | Hardware(2) | Bash(2) | Networks(2) | Graphviz(2) | Cloning | Cygwin | Graphics | Java | SystemRecovery | lessc | Maven | Python | PXE | Samba | LXDE | PackageManagement | LifeHacks | LESS |

This site has been archived and will no longer be updated.
You can find my new homepage at neilpahl.com.

Mapping A Network Drive in (winXP) Command Prompt

Tags:  WinCommandPrompt   NetworkDrives   
Created on Fri, 25 Nov 2011.
Last Modified on Wed, 04 Apr 2012.

Motivation Behind This Cheatsheet

I needed an easy way to add network samba network drives using the command line. It mounts to a drive instead of going through the networks explorer. Also, using the command line was preferable as it allows for use in batch files.

The Cheatsheet

If you have a username and password, try using the net use command like this:
Also from Vista OPK Lab File:

net use g: \\<SERVERNAME>\winbits /user:<SERVERNAME>\userName password

g:

Where userName is the User name, followed by a space then the Password, which in this case is "password"


Delete a network drive with:

net use g: /delete

Further Discussion

I used this on windows xp originally. I think I remember using this on vista. Using in a batch file can hang a bit if you don't have connection do the network resource.

Use CAUTION when leaving your username and password in a batch file.They could be read by anyone reading the file, and they can be recorded in the command line history logs. I did it because the network was very low risk. Best practice would have you store your password and username in another (restricted) file.



PLEASE let me know if I'm doing something wrong, or if you have any suggestions or requests~

blog comments powered by Disqus