-2

How to copy a file from one drive to another drive using a robocopy in a batch file script. The source path and destination path should be given as input by the user including the file name. Thanks in advance.

This is the code that i have tried.

      @REM Sample batch file

      Set /p filename1=Enter the source path:%=%
      Set /p fileparam=Enter the file name:%=%

      Set /p filename4=Enter destination path:%=%

      echo
      pause

      robocopy %filename1% %filename4% %fileparam%.txt /E /MIR

      echo
      pause
user3679072
  • 7
  • 1
  • 8
  • please try to type `HELP ROBOCOPY` on a command prompt. – PA. Jan 12 '15 at 11:14
  • That i tried @PA. but i need to create a batch file which should the file name as input from the user then it should copy in destination path.. – user3679072 Jan 12 '15 at 12:59
  • show us please what you have tried. The easiest way to pass some input from the user to a BAT file is to pass a parameter in the command line, or an implied parameter from the explorer; and receive it as `%1` in the BAT. – PA. Jan 12 '15 at 13:20
  • Check the code which i have uploaded @PA. – user3679072 Jan 13 '15 at 06:40
  • and, what is your problem? is it failing? – PA. Jan 13 '15 at 10:24

1 Answers1

1
   set /p Source_Folder="%Old_Client_Folder%"
   set /p Destination_Folder="%New_Client_Folder%"
   robocopy "\\%Old_Client_Folder%\" "\\\%New_Client_Folder%\" /MOVE /E
user3795654
  • 86
  • 3
  • 12