I want to pass a bunch of boolean flags to a Windows batch script function. Something like this:
1 SETLOCAL
2 SET _debug=1
3 SET _x64=1
4
5 call :COMPILE %_debug% %_x64%
6 :: call again where %_debug% is now 0
7 :: call again where %_x64% is now 0
8 :: etc...
9
10 :COMPILE
11 :: stuff depending on input args
I am using variables _debug
and _x64
to make the calls (line 5-7) more readable, as opposed to something like this:
call :COMPILE 0 1
Is there a simple way to pass the equivalent of not variable
? Like:
call :COMPILE ~%_debug% ~%_64%
or
call :COMPILE (%_debug% eq 1) (%_64% eq 1)
or do I have to declare not-variables like:
SET _debug=1
SET _not_debug=0
SET _x64=1
SET _not_x64=0
It's easy enough when I just have these 2 variables, but I anticipate having more.
edit based on initial response:
Regarding lines 6 and 7, where I wrote:
6 :: call again where %_debug% is now 0
7 :: call again where %_x64% is now 0
I am not interested in actually changing the values of _debug
and _x64
to 0. What I want to know is if there is a way to pass "not _var" to the function. This way I can preserve the meaning of the argument.