For won't run if errorlevel's too high
Posted: 30 Dec 2012 07:56
Hi!
I've been trying to create a program which allows you to type up a piece of text with asterixes in place of the letters and numbers. This is my code
I've tested everything; the letters that aren't displayed have their own proper errorlevel, but if the errorlevel is 33 (number 6) or higher, then the for loop will not execute. It's really annoying
I've been trying to create a program which allows you to type up a piece of text with asterixes in place of the letters and numbers. This is my code
Code: Select all
@echo off
title %~n0
color 0b
set chars=a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 0
set text=
set in=
set asterix=
:main
cls
echo Current Value: %text%
choice /c %chars: =% /n /m "Text: %asterix%"
::debug
echo errorlevel: %errorlevel%
pause
::bug is here. if errorlevel higher than 32, then it wont execute
for /f "tokens=%errorlevel%" %%G in ("%chars%") do (
echo if you see this message, then the loop is successful.
pause
set text=%text%%%G)
set asterix=%asterix%*
goto :main
I've tested everything; the letters that aren't displayed have their own proper errorlevel, but if the errorlevel is 33 (number 6) or higher, then the for loop will not execute. It's really annoying
