Solved how to read text file and assign the value in a variable

June 22, 2012 at 06:27:35
Specs: Windows 7
how to read text file and assign the value in a variable using batch file

Thanks in advance


See More: how to read text file and assign the value in a variable

Report •


#1
June 22, 2012 at 07:28:02
depending on what your one sentence question intends.

you might be able to use a

for /f "tokens=*" %%g IN (c:\textfile.txt) DO set variable1=%%g

If it is a one line text file. The trouble lies in if there is more then one line.

:: mike


Report •

#2
June 23, 2012 at 02:00:32
✔ Best Answer
::
:: jugs.bat Sat 23-06-2012 15:55:29.92
@echo off & setLocal enableDELAYedeXpansioN

set N=
for /f "tokens=* delims= " %%a in (myfile) do (
set /a N+=1
set VAR!N!=%%a
)
set
goto :eof

::====== script ends here =================


=====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question