I am using the call
command:
call beingcalled.bat randomnumber
In beingcalled.bat:
@echo off set call=%1 echo %call% set call=%call%%call% call caller.bat %call%`
In caller.bat:
@echo off set calltwo=%1 echo %calltwo% if "%calltwo%"== "" ( echo Error ) else ( call beingcalled.bat randomnumber )
Why does the command if "%calltwo%"== ""
not work? And how do I see if a variable was set?
IF "%Variable%"=="" ECHO Variable is NOT defined
This should help but this works, provided the value of Variable does not contain double quotes. Or you may try. Both worked for me.
VERIFY OTHER 2>nul SETLOCAL ENABLEEXTENSIONS IF ERRORLEVEL 1 ECHO Unable to enable extensions IF DEFINED MyVar (ECHO MyVar IS defined) ELSE (ECHO MyVar is NOT defined) ENDLOCAL
source http://www.robvanderwoude.com/battech_defined.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With