2

How to copy files from one server to another server using a batch ?

This are my command.

@echo off   
xcopy /e D:\Data Source\Image "\\192.168.0.1\C$ ABCDI123 /user:ABCD\Administrator \D:\Data Source\\Image
exit
  1. Source Folder: /e D:\Data Source\Image
  2. Server: 192.168.0.1
  3. Username: ABCD\Administrator
  4. Password:ABCDI123
  5. Destination Folder: \D:\Data Source\Image

Im not getting an error but file was not found at the destination folder. I want to clarify does my syntax are in correct order ?

JohnCincau
  • 39
  • 2
  • 1
    Your source directory is wrong, your destination directory is wrong, your command line does not match the data you included in the body content and xcopy does not include options for a username or password. – Compo Sep 12 '22 at 05:20
  • 2
    What you'll need to do, is to use the `net.exe` utility with the `use` argument to first map the server location to a drive letter. That command will accept your username and password. Then you can run your `xcopy.exe` utility command line using the newly mapped drive letter as the location. Finally delete the drive mapping using the `net.exe` utility and its `use` argument again. Please open a Command Prompt window, type ```net use /?``` and press the `[ENTER]` key to find out how to use that utility. You should also do the same thing with ```xcopy /?```, to confirm your syntax and options. – Compo Sep 12 '22 at 05:39
  • 2
    To start off, do you perhaps see something wrong with your double quoting? Though fixing that would not fix the problem, but it is important to understand why you need to double quote paths, especially with paths containing spaces. – Gerhard Sep 12 '22 at 05:42
  • Ohh the double quoting is my mistake while writing this question. – JohnCincau Sep 12 '22 at 06:12

0 Answers0