Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch file parsing a text file
Name: GEAK Date: February 18, 2009 at 16:23:19 Pacific OS: Windows XP Subcategory: General
Comment:
I currently have a batch file with the following lines at or near the beginning:
SET TargetIP=www.somesite.com SET PingCount=10
Rather than have the user modify my batch file, I'd like to have the values "www.somesite.com" and "10" in a text file (call it "variables.txt") which the batch file would read. Is this possible?
Name: Valerie (by Garibaldi) Date: February 18, 2009 at 23:58:53 Pacific
Reply:
Because it's just a 2-line text file here's a real lazy way...
:: Code begins....
@echo off
cls
for /f "delims==" %%A in (variables.txt) do (
set TargetIP=%%A & goto next
)
:next
for /f "delims==" %%A in (variables.txt) do (
set PingCount=%%A
)
echo TargetIP=%TargetIP% PingCount=%PingCount%
:: Code ends....
Summary: Hi I'm trying to create a batch file that will parse a text file and copy these files into the correct folders. The problem that I having is the file names and extension that I want the batch file to...
Summary: I had some great help yesterday with another issue and thought I would try this one. I need to replace 12 characters in a text file with a different string of 12 characters. How could I do this in a b...
Summary: Hi, I need a batch file to edit a text file. This file contains test results from a program. The data is separated by spaces and "00000" (space and numbers as delimiter?). I need to have each of them ...