how to automatically logon to shared folder?

2

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?

Ali Tarhini

Posted 2010-12-04T21:55:19.333

Reputation: 123

Answers

2

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:

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

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

NET USE [/PERSISTENT:{YES | NO}]

shf301

Posted 2010-12-04T21:55:19.333

Reputation: 7 582