Computing.Net > Forums > Disk Operating System > variable assignment: how-to ?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

variable assignment: how-to ?

Reply to Message Icon

Name: jazzy
Date: July 24, 2003 at 17:19:36 Pacific
OS: windows 2000
CPU/Ram: not sure
Comment:

hi,

i have a file, raspwd.txt, with only one
line containing one phrase. i would like to
know how do i assign the content of this
file to a variable in a batch file.

thanx,
tt



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: July 25, 2003 at 01:07:27 Pacific
Reply:

Use the following:

@Echo Off

:: XASG.BAT Syntax: XAsg
:: Assign the content of the one-row file File to Phrase.
:: Set File to the desidered Pathname-Filename

Set File=raspwd.txt
For /F "tokens=*" %%A in (%File%) Do Set Phrase=%%A
Echo.
Echo File [%File%] stores [%Phrase%]

Have a nice day


0

Response Number 2
Name: jazzy
Date: July 25, 2003 at 11:20:15 Pacific
Reply:

this works great ! thank you so much.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Annoying DOS Error - Plea... DoS program



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: variable assignment: how-to ?

Assigning values to variables (Please help) www.computing.net/answers/dos/assigning-values-to-variables-please-help/3851.html

how to find a directory www.computing.net/answers/dos/how-to-find-a-directory/14132.html

Assign Date to a Variable in Batch File www.computing.net/answers/dos/assign-date-to-a-variable-in-batch-file/4748.html