msiva1989
msiva1989

Reputation: 33

batch to connect network drive in non interactive method

I want to run one batch script to run non-interactive method to connect other network shared drive.

But, i don't want to hard code the password in net use command.

Please suggest any other ways to connect network shared drive?

thanks.

Upvotes: 0

Views: 1146

Answers (1)

Cividan
Cividan

Reputation: 108

You do not mention that you want the credential hidden, just that you do not want to hardcode them into the batch file so you can put the username and password in external file and then set the variable from reading these file.

set /p username=

net use x: \server\share /user:%username% %pass%

after that if you need to hide the password then you can put it in alternate stream of the file and read that from the script.

Upvotes: 1

Related Questions