G
Guest
I have a batch file (pasted below). It worls fine in W2K server, but I get a
"cannot perform a cyclic copy" error in Win 2003 server. I'm very stumped.
I've seen the question posed around the net, but no answers. Thanks for
looking.
Scott
rem *** Check usage.
if "%~1" EQU "/?" goto Usage
if "%~1" EQU "-?" goto Usage
if "%~1" EQU "?" goto Usage
if "%~1" EQU "" goto Usage
rem set environment
set PROGNAME=%~1
set OUTDIR=%~2
set OLDNAME=%~3
set NEWNAME=%~4
rem Check old files don't already exist
dir %OUTDIR%\%OLDNAME% /s
if %errorlevel% LSS 1 goto OVERWRITE
:START
cls
echo Run and Rename Batch File
echo .
echo PROGNAME= %PROGNAME%
echo OUTDIR = %OUTDIR%
echo OLDNAME = %OLDNAME%
echo NEWNAME = %NEWNAME%
echo.
echo.
%PROGNAME%
rem 09apr2004 JL on error exit with errorcode ------
if %errorlevel% GTR 0 exit %errorlevel%
rem 09apr2004 JL on error exit with errorcode ------
xcopy %OUTDIR%\%OLDNAME% %OUTDIR%\%NEWNAME% /Y /E /S
if %errorlevel% GTR 0 goto END
del %OUTDIR%\%OLDNAME% /Q/S
goto END
:USAGE
echo USAGE: run_ren "programname" "outputdir" "oldname" "newname" [/Q]
echo.
echo ex. runandren "reg_age.exe "" rif 06nov2003 68 """ "%iWBREPDIR"
"reg_age.re?" "reg_age_rif.re?" /Q
echo.
echo *** Must use quotes around parameters
echo *** Use a wildcard ? on file names to allow for proper replacement.
echo *** WARNING: With wildcards, reg_age.rep and reg_age.ret are the
same!
echo.
echo /Q for disable overwrite protection
echo.
echo *** Use /Q with caution when using ECS. Avoid having two jobs
conflicting.
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto END
:OVERWRITE
if /I "%5" EQU "/Q" goto DELFILES
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
cls
if not defined iwbecsdir goto NOTDEFINED
echo Files %OLDNAME% were found in %OUTDIR%
echo.
%iWBECSDIR%\query.exe "Do you want to continue (N/Y)? " NY 60
if not errorlevel 1 goto END
ELFILES
del %OUTDIR%\%OLDNAME% /Q /S
goto START
:NOTDEFINED
echo iWBECSDIR is not defined!
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto end
:OWERROR
exit 1
:END
"cannot perform a cyclic copy" error in Win 2003 server. I'm very stumped.
I've seen the question posed around the net, but no answers. Thanks for
looking.
Scott
rem *** Check usage.
if "%~1" EQU "/?" goto Usage
if "%~1" EQU "-?" goto Usage
if "%~1" EQU "?" goto Usage
if "%~1" EQU "" goto Usage
rem set environment
set PROGNAME=%~1
set OUTDIR=%~2
set OLDNAME=%~3
set NEWNAME=%~4
rem Check old files don't already exist
dir %OUTDIR%\%OLDNAME% /s
if %errorlevel% LSS 1 goto OVERWRITE
:START
cls
echo Run and Rename Batch File
echo .
echo PROGNAME= %PROGNAME%
echo OUTDIR = %OUTDIR%
echo OLDNAME = %OLDNAME%
echo NEWNAME = %NEWNAME%
echo.
echo.
%PROGNAME%
rem 09apr2004 JL on error exit with errorcode ------
if %errorlevel% GTR 0 exit %errorlevel%
rem 09apr2004 JL on error exit with errorcode ------
xcopy %OUTDIR%\%OLDNAME% %OUTDIR%\%NEWNAME% /Y /E /S
if %errorlevel% GTR 0 goto END
del %OUTDIR%\%OLDNAME% /Q/S
goto END
:USAGE
echo USAGE: run_ren "programname" "outputdir" "oldname" "newname" [/Q]
echo.
echo ex. runandren "reg_age.exe "" rif 06nov2003 68 """ "%iWBREPDIR"
"reg_age.re?" "reg_age_rif.re?" /Q
echo.
echo *** Must use quotes around parameters
echo *** Use a wildcard ? on file names to allow for proper replacement.
echo *** WARNING: With wildcards, reg_age.rep and reg_age.ret are the
same!
echo.
echo /Q for disable overwrite protection
echo.
echo *** Use /Q with caution when using ECS. Avoid having two jobs
conflicting.
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto END
:OVERWRITE
if /I "%5" EQU "/Q" goto DELFILES
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
cls
if not defined iwbecsdir goto NOTDEFINED
echo Files %OLDNAME% were found in %OUTDIR%
echo.
%iWBECSDIR%\query.exe "Do you want to continue (N/Y)? " NY 60
if not errorlevel 1 goto END
ELFILES
del %OUTDIR%\%OLDNAME% /Q /S
goto START
:NOTDEFINED
echo iWBECSDIR is not defined!
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto end
:OWERROR
exit 1
:END