Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file help please.........

Status
Not open for further replies.

arie01

Technical User
Nov 24, 2003
23
CA
Hello,

I need to create a batch file to copy files from one stand alone server to another stand alone server over the Internet. The servers are not in the same domain or forest.

I would like to know how can I use the command prompt to map a drive from one computer to another and pass credentials. I know I can do "NET USE * \\SERVERNAME\SHARENAME" but because the servers are not on the same network, I need to provide a local username and password in the command.

How do I do that?

Thank you,
Arie
 
I don't understand the question: net use accepts a password as parameter

Cheers,
Dian
 
Yes, but is the proper syntax? I tried a few things and it didn't accept it.

Thank you,
Arie
 
Yes, but what is the proper syntax? I tried a few things and it didn't accept it.

Thank you,
Arie
 
I got it to work!

Here is the correct syntax:

net use X: \\ServerName\ShareName /user:ServerName\UserName <password> /persistent:no

Note: <password> is the actual password of the user that was entered in UserName.

It worked fine for me.

Thank you,
Arie
 
Don't do that. If the server (firewall, network connection, etc) is configured such that windows file sharing is open to the internet you are going to have big problems.

There are many other ways to pass information across the internet. A VPN would be preferred, but you can use FTP if nothing else is available. Do not open windows file sharing to the internet!
 
Hello smah,

How can I use FTP in a batch file?
How can I tell it to change directory to such and such directory on the remote server (and on the local server) and copy only the files I want?
How can I time it in such a way that the batch file executes the next command only when the FTP finishes copying the files it needs to copy?

If this is all possible from within a batch file in a fully automated way, please let me know how can I construct my batch file.

Thank you for your reply,
Arie
 
There seems to be several utilities available to [google]automate ftp[/google]
 
And FTP is any more secure????? If the OP has to use FTP, he is better off using SFTP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top