Here is a very simple batch file called "copyTXT.bat", that I am trying to execute:
XCOPY /v D:\temp\MyFile.txt D:\Documents\
For some reason that I just cannot grasp, it fails. It flashes a window for 1/10 of a second and do nothing, no copy at all.
If I call the batch file from a command window it will generate the following error message:
" X is not recognized as an internal or external command… "
Yet , If I run the command directly in the command window It will execute and perform as intended.
Some users happen to think that it could be a question of rights or a badly defined Path. I am using this in an Administrator account and I checked my Path environment which include the C:\Windows\System32 folder. I also copied the XCOPY.EXE file right into the D:\temp folder, just to make sure. I am executing the batch file from the D:\temp folder and this is also the location of the batch file itself. Furthermore, I can run the same exact batch file on another computer running the same windows 7 OS.
What am I doing wrong ? How come the batch file fail and yet I can execute the command directly with no problem ?
Best Answer
There's probably a ZWS (Invisible character) between the
X
and theCOPY
just rewrite the command yourself without any ZWS that would probably fix it.