Computing.Net > Forums > Windows 2000 > Reading a text file from a script

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.

Reading a text file from a script

Reply to Message Icon

Name: oilernut
Date: November 6, 2007 at 14:59:05 Pacific
OS: Win 2000
CPU/Ram: 1gb
Product: Dell
Comment:

I am trying to create a batch file that will read a text file full of computer names and the location of a license key for a program.
So for example:
WS123 C:\UN5.esu
WS124 C:\UN6.esu
Right now the file is tab delimitated but that could be changed if required.

Basically I want a script to look up the computer name and match it to a file location for a license, possibly into a variable.
It would then pass that file location to an exe file that can register it like this:
RegisterFixed92.exe /s /LIF=%licensefile%



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 7, 2007 at 07:21:28 Pacific
Reply:

:: get license filename and pass it to exe

@echo off
setLocal EnableDelayedExpansion

set /p PC=which PC?

for /f "tokens=2 delims= " %%a in ('find "!PC!" ^< myfile') do (
set licensefile=%%a
)
echo RegisterFixed92.exe /s /LIF=%licensefile%


=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: Reading a text file from a script

Win2000 and XP variable from a text file www.computing.net/answers/windows-2000/win2000-and-xp-variable-from-a-text-file/35180.html

Need to read a text file from a batch file www.computing.net/answers/windows-2000/need-to-read-a-text-file-from-a-batch-file/65828.html

Batch script for parsing text file www.computing.net/answers/windows-2000/batch-script-for-parsing-text-file/63351.html