Solved searching for number in text file and modify it in for loop

November 14, 2013 at 05:43:42
Specs: Windows 7
I have a text file called txtfile.txt and it has inside it for example the following:

x = 0
y = 0
z = 10
I want to run a for loop from -x to +x with steps of y to search for z and add the number (x) to it.

How can I do this.

thanks


See More: searching for number in text file and modify it in for loop

Report •

#1
November 14, 2013 at 07:04:51
✔ Best Answer
::sets the variables from the file
setlocal enabledelayedexpansion
for /f "tokens=*" %%G IN (d:\textf.txt) DO (
set q=%%G
echo !q: =!>>r.txt
)
for /f "tokens=*" %%g IN (d:\r.txt) DO set /a %%g
::not entirely sure what you were looking for here

for /l %%C IN (-%x%,%y%,%x%) DO echo whatever
set /a new=x+z
echo %new%

::mike

message edited by mikelinus


Report •
Related Solutions


Ask Question