I have developed a batch file that is designed to check a value in a given excel sheet. And decides what to do depending of the value in the Excel sheet (value either 0 or more than zero)
Code is as follows
@echo off
setlocal EnableDelayedExpansion
cd\
D:
cscript //nologo testexcel.vbs
IF !ERRORLEVEL! EQU 1 (
taskkill /F /IM explorer.exe
*****MORE ACTIONS HERE*****
SET running=0
FOR /f "tokens=*" %%A IN ('tasklist^ /v^| findstr /i /c:"iexplore.exe"') DO SET running=1
IF %running% == 0 (
explorer.exe
)
) ELSE (
***OTHER ACTIONS HERE***
)
exit
The code will run a VBscript using the cscript command and will; return a ERROR LEVEL value, either ERROR LEVEL is 1 or otherwise. For some reason I keep getting the below error:
( was unexpected at this time.
I understand that this may be happening due to the due to all the commands and variables within those parentheses are expanded. But I am using setlocal EnableDelayedExpansion
but still getting the same error.