Reputation: 53
I was trying to use XCOPY
in my batch file, but it is not doing anything.
The echo statement used is printing infinite times and its not terminating at all.
@echo off
echo "Script Started"
XCOPY "C:\Users\feroz\Desktop\Datafeed\Git Data\" "C:\ProgramData" /E > NUL
pause
Upvotes: 0
Views: 2875
Reputation: 38579
As per my comment…
If the script is continually looping, which is what you're describing in your question, you have probably named your batch file xcopy.bat
or xcopy.cmd
? If so, please change the name to something which isn't the name of another available executable, or change XCOPY
to XCopy.exe
.
Even better would be to ensure that you're calling the fullpath to XCopy.exe
, using %__APPDIR__%XCopy.exe
:
@Echo Off
Echo "Script Started"
"%__APPDIR__%XCopy.exe" "C:\Users\feroz\Desktop\Datafeed\Git Data" "C:\ProgramData" /E>Nul
It's more likely that you'd want however to copy everything to a directory within C:\ProgramData
so I'd suggest something a little more like this:
@Echo Off
Echo "Script Started"
"%__APPDIR__%XCopy.exe" "C:\Users\feroz\Desktop\Datafeed\Git Data" "C:\ProgramData\Git Data\" /E>Nul
In this case, the trailing backslash on the destination will create the directory if it doesn't already exist.
Upvotes: 1