Computing.Net > Forums > Windows 2000 > Win2000 and XP variable from a text file

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.

Win2000 and XP variable from a text file

Reply to Message Icon

Name: Alberto Levy
Date: August 9, 2002 at 10:39:43 Pacific
Comment:

Dear friends, I´m having trouble assigning a env variable with a line from a text file.
Does anyone could give me some light?
I´d really appreciate.
Thanks in advance,
Alberto



Sponsored Link
Ads by Google

Response Number 1
Name: sancho
Date: August 9, 2002 at 10:53:07 Pacific
Reply:

need to know which env variable.


You can write a batch file in notepad by just naming the file whatever.bat and including the lines to set the environment variable of your choice.

i.e.

@echo off *//will not display each line input
set path = %path%;c:\example

this would add c:\example to your path statement.


0

Response Number 2
Name: Alberto Levy
Date: August 9, 2002 at 10:57:49 Pacific
Reply:

Thank you Sancho. Let me try to explain better my problem.
I´d like to read a text file that already exists and set up a variable, e.g. ALBERTO with the content of its first line.
It{s a part of a bigger problem and it´s the missing part of it.
Thank you once more,
Alberto


0

Response Number 3
Name: Henny Sol
Date: September 1, 2002 at 06:58:24 Pacific
Reply:

See the batchfile below: the user variables DATUM and TIJD will be set to parts of the first (and only) line of the %username% file:

echo off
rem GETDATETIME

date /t>%USERNAME%
for /F "tokens=2" %%i in (%USERNAME%) do (
echo %%i > %USERNAME%
)
rem Set the char after delims to the DateSeperator (see ControlPanel)
for /f "tokens=1,2,3 delims=/" %%i in (%USERNAME%) do (
set DATUM=%%i%%j%%k
)
time /t>%USERNAME%
for /F "tokens=1,2 delims=:" %%t in (%USERNAME%) do @set TIJD=%%t:%%u

del %USERNAME%


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Windows 2000 VPN and Wind... CD player



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: Win2000 and XP variable from a text file

Reading a text file from a script www.computing.net/answers/windows-2000/reading-a-text-file-from-a-script/65233.html

Create users in Windows 2000 server from text file www.computing.net/answers/windows-2000/create-users-in-windows-2000-server-from-text-file/4924.html

append text from another text file www.computing.net/answers/windows-2000/append-text-from-another-text-file/65414.html