Trying to use Move vs. Xcopy in a batch file
Posted: 01 Feb 2011 15:16
Greetings All.
I have the following batch file that returns the error
"The syntax of the command is incorrect."
If I replace the "move" with "Xcopy" the batch runs with no issue. The file is copied.
I need to move the random file instead of copy it. What do I have wrong?
Kindest Regards,
Snake Eyes
I have the following batch file that returns the error
"The syntax of the command is incorrect."
Code: Select all
@echo off
cls
setlocal enabledelayedexpansion
set /a rand=%random%%%176+1
pushd M:\Wallpapers 1
set nbr=1
for /f "delims=*" %%1 in ('dir /a-d /b *.jpg') do (
set file=%%1
set /a nbr+=1
if !nbr! gtr !rand! goto getout
)
:getout
move "%file%" "M:\Test\*.*" /y
If I replace the "move" with "Xcopy" the batch runs with no issue. The file is copied.
I need to move the random file instead of copy it. What do I have wrong?
Kindest Regards,
Snake Eyes