Link to home
Start Free TrialLog in
Avatar of moni81011
moni81011

asked on

move a file from one server to another server using a batch file

Can anyone tell me how to move a file from one server to another server using a batch file?  I can move a file within the same server, but not able to move it to another server.
ASKER CERTIFIED SOLUTION
Avatar of Anuroopsundd
Anuroopsundd
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bill Prew
Bill Prew

What have you tried that didn't work, and what was the error(s)?

~bp
Avatar of moni81011

ASKER

Could we do it the other way around?  Could we place this .bat file on the server the file is going to and grab the file from the server it is coming from?

Thanks in advance.
What Anuroopsundd told me to do works, but I'm not exactly sure how to place the .bat file on our host as that is where the file resides.  So I wanted to see if there is a way to place the .bat file on the server the file is supposed to go to and what code needs to be changed in the .bat file.
Should work the same way, just reverse the parms in the COPY, like:

net use x: \\servername\sharename  password /USER:myAccount
copy x:\text.txt c:\destdir
net use x: /delete

~bp
I'm not 100% sure how to make that work.  Ok, this is what I did the first time to make it work:

I got a file from my pc and placed it on the server using what Anuroopsundd provided like this:

net use x: \\servername\sharename path (2nd server-destination server)
copy C:\Users\path\filename x:\
net use x: /delete

and that works.

Now I want to be able to put the .bat file on the second server where the file should end up at and tell it to go to the host and grab this file and put it on this server.
If I just reverse the second line where it is copying the information, it is looking for the file on the second server, which it will never find cause it resides on the first server.
Do I make any sense? I hope I do.  :)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.  I tried that, but for some reason it does not work.  
Thank you for all your help.