# 【cmd】IF ELSE 复制(copy)文件问题

cmd中复制文件`COPY`命令一般都不会有问题，但是如果把`COPY`放在`IF ELSE`中可能导致批处理文件无法运行。

test

|—folder1

|—|—a(b).txt

|—folder2

copy复制语句似乎没有问题。

### 总结

Character to be escaped Escape Sequence Remark
% %% May not always be required in doublequoted strings, just try
^ ^^ May not always be required in doublequoted strings, but it won’t hurt
& ^& May not always be required in doublequoted strings, but it won’t hurt
< ^< May not always be required in doublequoted strings, but it won’t hurt
> ^> May not always be required in doublequoted strings, but it won’t hurt
^’ Required only in the FOR /F “subject” (i.e. between the parenthesis), unless backqis used
` ^` Required only in the FOR /F “subject” (i.e. between the parenthesis), if backq is used
, ^, Required only in the FOR /F “subject” (i.e. between the parenthesis), even in doublequoted strings
; ^; Required only in the FOR /F “subject” (i.e. between the parenthesis), even in doublequoted strings
= ^= Required only in the FOR /F “subject” (i.e. between the parenthesis), even in doublequoted strings
( ^( Required only in the FOR /F “subject” (i.e. between the parenthesis), even in doublequoted strings
) ^) Required only in the FOR /F “subject” (i.e. between the parenthesis), even in doublequoted strings
! ^^! Required only when delayed variable expansion is active
“” Required only inside the search pattern of FIND
\ \\ Required only inside the regex pattern of FINDSTR
[ \[ Required only inside the regex pattern of FINDSTR
] \] Required only inside the regex pattern of FINDSTR
\ \\ Required only inside the regex pattern of FINDSTR
. \. Required only inside the regex pattern of FINDSTR
* \* Required only inside the regex pattern of FINDSTR
? \? Required only inside the regex pattern of FINDSTR