1.

Solve : add result of a command in variable?

Answer» HI, i am NEW in this forum and i need to know
How to add  the result of a command in variable?

thx
 
What do you mean by result ? the errorlevel ? a PRINTED line of TEXT ?C:\test>type result.bat
ECHO off
set /a result=0
:loop
set /a result=%result% + 1
if %result%==10 goto end
goto loop
:end
echo result=%result%
echo bye

Output:

C:\test>result.bat
result=10
bye

C:\test>
____________________________________


C:\test>type result.bat
echo off
set /a result=0
:loop
set /a result=%result% + 1
if %result%==%1 goto end
goto loop
:end
echo result=%result%
echo bye

Output:

C:\test>result.bat 15
result=15
bye

C:\test>result.bat 4
result=4
bye

C:\test>


Discussion

No Comment Found