Here is my script:
echo off
Set "_localState="
Set _localState=YES
if %_localState%==YES (
echo dim answer > %tmp%\tmp.vbs
echo answer=MsgBox("Target Question?",4,"Question") >> %tmp%\tmp.vbs
echo wscript.echo answer >> %tmp%\tmp.vbs
for /f "delims=" %%a in ('cscript //nologo %tmp%\tmp.vbs') do (
set ScriptOut=%%a)
del %tmp%\tmp.vbs
if %ScriptOut%==6 (
msg %username% "LOCAL is connected."
)
)
pause
If I remove outer if condition if %_localState%==YES
it will work, but currently not. Where is the problem?