単純なバッチファイルでエラーが発生します。このファイルは、ファイル「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