-
Help With Batch Code
I'm working on a project for my son. I want to imitate the code for the matrix in CMD using a .bat file.
~note: this is an example of whats going on, not the whole code
:start
@set /a bottomlimit = 0
@set /a upperlimit = 2
@set /a result1 = %bottomlimit% + %random% %% (%upperlimit% - %bottomlimit% + 1)
if %result1% == "2" set /a result1 = " " <- this is the part that is messing up, it doesnt change the 2 to a blank space and keeps echoing as 2
echo %result1%
goto start
-
Re: Help With Batch Code
This is a Visual C++ forum.
-
Re: Help With Batch Code
If you want to compare strings, you need to make the left-hand-side a string as well. And don't use /a when not performing a arithmetic assignment. You should also remove the spaces around "=" in your set commands (I don't use any spacing anywhere).
Code:
if "%result1%" == "2" set result1=" "
echo %result1%
I like to use this site for reference: http://ss64.com/nt/
gg