Windows batch files

I need to create a batch file that runs on a machine and connects network drives. The machine and file server are on different domains but are trusted.

The batch file needs to ask the user for credentials then pass those credentials for authentication.

Any pointers?
Who is Participating?
Michael PfisterConnect With a Mentor Commented:
set /p NETUSER=Please enter user name for connection:
If defined NETUSER net use * \\SERVER\Share /user:OTHERDOMAIN\%NETUSER% 

Open in new window

This will prompt the user for a user name and pass it to the net use command. replace SERVER, Share and OTHERDOMAIN with your values
Michael PfisterCommented:
On the other hand since there is a trust you should be able to grant the user from domain A access to ressources in domain B.
No need to prompt for username...
ISTAuthor Commented:
Great, works fine....
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.