Batch file parsing a text file

February 18, 2009 at 16:23:19
Specs: Windows XP
I currently have a batch file with the following lines at or near the beginning:

SET PingCount=10

Rather than have the user modify my batch file, I'd like to have the values "" and "10" in a text file (call it "variables.txt") which the batch file would read. Is this possible?

See More: Batch file parsing a text file

Report •

February 18, 2009 at 23:58:53
Because it's just a 2-line text file here's a real lazy way...

:: Code begins....
@echo off

for /f "delims==" %%A in (variables.txt) do (
     set TargetIP=%%A & goto next


for /f "delims==" %%A in (variables.txt) do (
     set PingCount=%%A

echo TargetIP=%TargetIP%    PingCount=%PingCount%

:: Code ends....

Report •
Related Solutions

Ask Question