Cinchoo / ChoEazyCopy

Simple and powerful RoboCopy GUI
MIT License
1.78k stars 119 forks source link

Safeguard the last '\' to enable copy from drive root #9

Closed aflyhorse closed 6 years ago

aflyhorse commented 6 years ago

As reported in issue #2 , Windows cmd tends to translate the last '\' into escape character, which results to an invalid parameter error.

This patch adds another slash to escape the intended slash.

Current Cho version:

C:\Windows\system32>RoboCopy.exe  "C:\" "E:\tmpzone" *.* /E /MT:8

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : 2018/2/2 10:56:41
   Source -
     Dest -

    Files :
  Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

ERROR : Invalid Parameter #1 : "C:" E:\tmpzone *.* /E /MT:8"
(abridged)

After my escape patch:

C:\Windows\system32>RoboCopy.exe  "C:\\" "E:\tmpzone" *.* /E /MT:8

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : 2018/2/2 10:57:34
   Source : C:\
     Dest : E:\tmpzone\

    Files : *.*

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /MT:8 /R:1000000 /W:30

------------------------------------------------------------------------------

100%        New File              384322        C:\bootmgr
100%        New File                   1        C:\BOOTNXT
            New File               3.1 g        C:\hiberfil.sys
2018/02/02 10:57:37 ERROR 32 (0x00000020) Copying File C:\hiberfil.sys
The process cannot access the file because it is being used by another process.

            New File               2.1 g        C:\pagefile.sys
2018/02/02 10:57:37 ERROR 32 (0x00000020) Copying File C:\pagefile.sys
The process cannot access the file because it is being used by another process.
(abridged)