if %something% ==1 (echo true) else (echo false)
I'm working on a batch file to randomize a config file, but I've run into a hitch for the true/false options.
I've got a system working to randomly pick a 1 or a 2, but how would I go about doing this:
If number is 1, set a variable=true
Else set a variable=false
Doing a random true/false =FIXED=
Moderator: DosItHelp
Re: Doing a random true/false =FIXED=
Hi Azrooh,
this should work
hope it helps
this should work
Code: Select all
set /a r=%random% %% 2
if %r%==1 (echo true) else (echo false)
hope it helps
Re: Doing a random true/false =FIXED=
Code: Select all
if %random:~-1% LSS 5 (echo true) else (echo false)