Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm creating scheduled tasks on windows7 to copy some files to a shared folder on another computer. however, the shared folder required a username and password to have copy permissions. how can i automatically provide the login credentials from the batch file i'm using?

share|improve this question
up vote 2 down vote accepted

There are a couple of ways, though they are relatively simple:

  1. Create an account on your computer with the same user name and password as the remote computer and have the bat file run as that account. (Or create an account on the remote machine with the same user name and password as your local machine)
  2. Connect to the remote machine and chose the option to save your credentials. Then run the schedule task under you user account so it will use the saved credentials.
  3. In the batch file use the net use command to connect to the share with a user name and password. The password will be in plain text in the batch file so this is not as secure as 1 or 2.

The syntax of net use is:

[devicename | *] [\\computername\sharename[\volume] [password | *]]
        [/USER:[dotted domain name\]username]
        [/USER:[username@dotted domain name]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .