Computing.Net > Forums > Disk Operating System > Getting Contents of 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.

Getting Contents of a Text File

Reply to Message Icon

Name: DJ_NRG
Date: April 29, 2003 at 13:13:04 Pacific
OS: DOS
CPU/Ram: 133/64
Comment:

Hello. I'm trying to write a batch file that can pull the contents (just a single word) from a text file. I am currently using a batch file to output the user context of a login to a text file.

What I am trying to do is make a batch file which will later take this same information contained in the text file and use it to name a different file.

Hopefully I have not made this too confusing. Thanks, in advance for any advice.




Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: April 29, 2003 at 17:25:29 Pacific
Reply:

Do you mean the string (word) is at the very begginning of the file, is that it?

If you're on DOS/Win9x, visit my FAQ:

FAQ #25 - Process data inside a file - send first line from file to a variable

If you're on a NT system (Windows NT/2000/XP), use FOR/F

for /F %%S in (filename.ext) do set word=%%S

That line should be executed from inside a batch file. For more information about the FOR cmd, type "for/?" on the command prompt.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

________________________________________________________


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 Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Getting Contents of a Text File

How Do I Pause The Viewing Of A Text File While In Pure DOS? www.computing.net/answers/dos/how-do-i-pause-the-viewing-of-a-text-file-while-in-pure-dos/5421.html

Redirecting text file to a variable? www.computing.net/answers/dos/redirecting-text-file-to-a-variable/3566.html

copying files listed in a text file www.computing.net/answers/dos/copying-files-listed-in-a-text-file/7341.html