What is wrong in this code ????
Posted: 13 Nov 2011 03:12
i have problem in this code
xcopy works fine but when add ELSE dont work
why that?
@echo off & setLocal EnableDELAYedeXpansion
for /f "tokens=* delims= " %%a in ('dir /s /b/a-d "c:\windows\temp2\"') do (
if not exist "c:\windows\temp\%%~nxa" xcopy "%%~pnxa" "c:\windows\temp\
goto bb
ELSE (GOTO start1)
)
:bb
echo no need to copy
ping -n 5 localhost> nul
exit
:start1
echo finish copy
ping -n 10 localhost> nul
exit
thanks in advance.
xcopy works fine but when add ELSE dont work
why that?
@echo off & setLocal EnableDELAYedeXpansion
for /f "tokens=* delims= " %%a in ('dir /s /b/a-d "c:\windows\temp2\"') do (
if not exist "c:\windows\temp\%%~nxa" xcopy "%%~pnxa" "c:\windows\temp\
goto bb
ELSE (GOTO start1)
)
:bb
echo no need to copy
ping -n 5 localhost> nul
exit
:start1
echo finish copy
ping -n 10 localhost> nul
exit
thanks in advance.