我在我的簡單批處理文件中出現一些錯誤。該文件旨在將文件「xyz.4do」複製到同一目錄,然後將複製的文件重命名爲「abc.4do」,最後將複製/重命名的文件移動到不同的文件夾。批量命令複製,重命名然後移動全部失敗
我的代碼是下面,我已經作了評論中發生的錯誤:
@ECHO off
CLS
SETLOCAL
SET file=C:/users/xyz/desktop/xyz.4do
SET newName=abc.4do
SET endDir=C:/users/abc/desktop
REM Error occurs on below line: "The system cannot find the file specified" but the file exists
COPY %file%
REM Error below: "The syntax of the command is incorrect"
REN %file% %newName%
REM Error occurs on below line: "The system cannot find the file specified"
MOVE %newName% %endDir%
ECHO.
PAUSE
ENDLOCAL
更改爲反斜槓但不起作用。它仍然說找不到第一個複製命令的文件。另外應該注意的是批處理文件在不同的目錄中執行,以至於xyz.4do是 –