Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a text file and the first line is a number. How can I get this number assigned to a variable inside a batch file?

Hi gman8
Change "set Num=%%a & set Num & exit /b"
to "set Num=%%a & & exit /b" if you dont
the variable Num displayed on screen.
Below is all one line.@echo off
for /f "tokens=1 delims= " %%a in (GetNum.txt) do set Num=%%a & set Num & exit /b

![]() |
Eval a batch var whose va...
|
Random Numbers according ...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |