Question Locked

How do pass user credentials with net use command?

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to create a batch file that will Create a daive mapping when the computer starts up. First I will tell you I have tried the gui's way of mapping a network drive, I tell it to remember the credentials, but it always forgets the password. I have also tried the net use /savecred(entials). My batch file is posted below, I can get it to all work except when i try to push along the password. the problem I am having is that the directions on the internet dont have an example of the password switch being used. From what I have read the switch is [password| *] everytime i enter it tells me that my password, or whatever is in that spot either my password or *, is not a recognizable internal command.

@echo off
net use /delete w: >nul
net use w: \\(server)\lantalk password:***** \user:*****
exit

5 replies

by scott_heath

net use \\\ /user:

Example:

net use w: \\myserver\fileshare /user:MyID MyPassword

I use this in more than one batch file.

by brhy

net use z: \\servername\folder /user:username password

by brhy

net use z: \\servername\folder /user:username password

by: Bryan Dalawangbayan 1/20/11

by brooks.b.j

(At least on Windows 7), you can specify your domain name on the command line, and also get it to prompt you for your password. For example:

net use x: \\server\fileshare /user:domain\username *

The asterisk prompts for the password, which does not get echoed on-screen. Better than having text passwords in command files...

This discussion is closed to new replies.