CMD-DOS Conversión de números a ASCII

So I have a number variable called: SET /A MAIN_SCORE=1 How do I get Main Score to represent length of the string character X. So I start off like this:

X

But when I come across the line which states: SET /A MAIN_SCORE = 3 + MAIN_SCORE The outcome is:

XXXX

Can you see where I'm getting at? Help would be appreciated. Sorry about the unclear message.

preguntado el 12 de septiembre de 13 a las 00:09

Do you want a string of X characters, where the length is equal to the value of MAIN_SCORE? If so, then edit your question to say so. If not, then I haven't a clue what you are asking. -

1 Respuestas

@ECHO OFF
SETLOCAL
SET xstring=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SET mainscore=1
CALL SET xs=%%xstring:~0,%mainscore%%%
ECHO %mainscore% : %xs%
SET /a mainscore=3 + mainscore
CALL SET xs=%%xstring:~0,%mainscore%%%
ECHO %mainscore% : %xs%

GOTO :EOF

debería hacer el truco

Respondido el 12 de Septiembre de 13 a las 01:09

So for that script, do I have to define the Maximum range e.g. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or does it go on forever as it imcrements? - user2507295

That's really a matter of practicality. You could for instance set xstring to a string of 8,000+ characters (set up a loop to append xtring to itself a few times, having initialised it to a goodly number.) What would be the practical use of displaying more than a single line? An entire standard screen would be 2080 characters..and there'd be nothing else displayed. Scaling is up to you. - Magoo

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.