Batch to copy and replace a txt file from one server to another
- by Sunny
I have two servers, server1 and server2 on same network but require username and password to be mapped. server1 has a text file as C:\Users\output.txt.
I want to create and schedule a batch script on server1, which should copy and replace output.txt file from server1 to server2 at path E:\data\output.txt on daily basis.
I don't want to map server2 manually every time I start my computer nor do I want to enter my username and password each time.
I am using following commands in a batch, but not working;
net use C: \\server2\E:\data server2password /user:server2domain\server2username /savecred /p:yes
xcopy C:\Users\output.txt E:\data\