im working on a basic .bat file. It checks if various files exists and if they dont, it will write "ERROR" in the log file. I then test this log file for the string "ERROR" and if it does I want to rename my log file, but i seem to be getting an error on my if statement. Heres my code..
set "filename=C:\Temp\%COMPUTERNAME%.txt"
echo Creating .txt file...
echo Getting the Computer name...
echo %COMPUTERNAME% >> filename
echo ArcGIS Desktop 10 File checker
pause
echo Looking for files.....
call:checkFileExists C:\support\msi_local\Oracle10g\marker.txt
pause
FIND "ERROR" filename
echo error level is %ERRORLEVEL%
pause
if %ERRORLEVEL% 1 (
set "newfileName=C:\Temp\%COMPUTERNAME%%_ERROR.txt"
rename fileName newfileName
)
pause
:checkFileExists
if exist %~1 (
echo Success %~1 does exist >> C:\Temp\%COMPUTERNAME%.txt
) else (
echo ERROR "C:\support\msi_local\Oracle10g\marker.txt"%~1 does not exist >> C:\Temp\%COMPUTERNAME%.txt
)
I get a error -
The syntax of teh command is incorrect.
C:\Windows>if ERRORLEVEL 1(
Where am i going wrong? Thanks