D:\temp\copyTXT.bat
is a simple script containing:
XCOPY /v D:\temp\MyFile.txt D:\Documents\
- Executing the script fails, flashing a window for ~100ms, then does nothing (no copy at all), but if I call the batch file from a terminal, it errors with:
X is not recognized as an internal or external command...
- If I run the command itself from a terminal, it performs as intended
Some think it could be a question of rights or a badly defined path:
- I am using an Administrator account and verified
%PATH%
includesC:\Windows\System32
- I've copied
XCOPY.exe
toD:\temp\
to make sure, and am executing the batch file from withinD:\temp
- I can run the same exact batch file on another computer running the same Windows 7 OS
What am I doing wrong? Why does the batch file fail, yet I can execute the command directly with no problem?
X is not recognized etc.
instead ofXCOPY
? I tried replicating the issue by putting one LF character (thus omitting the CR) betweenX
andCOPY
. Editors like Notepad would show everything on one line, which can be copy-pasted on the command prompt, running just fine. Starting the.bat
would give aX is not recognized
error and theCOPY
command would run instead. By saving as UTF-8 with BOM the batch would return╗┐XCOPY is not etc.
Not quite like yours, still.