Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello!!
At the bottom of this post is my tester for a Matrix Batch File. Problem? It keeps saying 'ECHO is off.'Don't know how to fix it. need your help.
Please have a look, and suggest a resolution.
@echo off
cls
color 0A:mtrxst2
@echo off
set /a mAsp=%random%%%6+1
if '%mAsp%'=='1' goto mtrxmA1
if not '%mAsp%'=='1' goto mtrxmA2
:mtrxmA1
set /a mA=%random%%%9+0
goto mtrxmA3
:mtrxmA2
set mA=
:mtrxmA3@echo off
set /a mBsp=%random%%%6+1
if '%mBsp%'=='1' goto mtrxmB1
if not '%mBsp%'=='1' goto mtrxmB2
:mtrxmB1
set /a mB=%random%%%9+0
goto mtrxmB3
:mtrxmB2
set mB=
:mtrxmB3@echo off
set /a mCsp=%random%%%6+1
if '%mCsp%'=='1' goto mtrxmC1
if not '%mCsp%'=='1' goto mtrxmC2
:mtrxmC1
set /a mC=%random%%%9+0
goto mtrxmC3
:mtrxmC2
set mC=
:mtrxmC3@echo off
set /a mDsp=%random%%%6+1
if '%mDsp%'=='1' goto mtrxmD1
if not '%mDsp%'=='1' goto mtrxmD2
:mtrxmD1
set /a mD=%random%%%9+0
goto mtrxmD3
:mtrxmD2
set mD=
:mtrxmD3echo %mA% %mB% %mC% %mD%
@echo off
goto mtrxst2

It's because you've got this line:
echo %mA% %mB% %mC% %mD%
and all the variables translate to an empty string, because none of them have been set. In that case, the command is actually just this:
echo
which means "tell me whether echo is on or off."
You can look through your code and work out the probability that any of these variables will have been set - it's like throwing a dice each time you are about to set a variable and only setting it if you throw a certain number.

I'am a Chinese,I'm not good at English...
'======================================
Because all %m?sp% is empty string, A B C D all jump to :mtrxm?2 very likely in near value seriesFix it code is so easy,just put a drop after "echo" ,like this:
'==================================
echo. %mA% %mB% %mC% %mD%
'==================================
this drop can hide 'echo is off' to reveal

and,your example have too much unnecessary code,you can truncate like this:
'================================
@echo off&color 0A&setlocal enabledelayedexpansion
:mtrxst2
set /a q+=1
set /a ALLsp%q%=!random!%%6+1
if !ALLsp%q%!==1 ( set /a "m%q%"=!random!%%9+0 ) else ( set m%q%= )
if %q%==4 ( set /a q=0 & echo. %m1% %m2% %m3% %m4%)
goto :mtrxst2
'================================
after amend,total code can lss than anyone str setting part in original code, just have 4 line of nucleus

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |