Computing.Net > Forums > Disk Operating System > how to write a string to a txt 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.

how to write a string to a txt file

Reply to Message Icon

Name: Sondre Stormo
Date: October 16, 2002 at 15:42:22 Pacific
OS: DOS
CPU/Ram: P2 800 128mb ram
Comment:

How do I write a string like "this is a test" into a txt file, hopefully at the end of the document in dos.



Sponsored Link
Ads by Google

Response Number 1
Name: Jeff Graver
Date: October 16, 2002 at 17:00:02 Pacific
Reply:

echo this is a test >> myfile.txt


0

Response Number 2
Name: - Uziel -
Date: October 16, 2002 at 20:12:23 Pacific
Reply:

1st here I show Jeffs exampel again:

ECHO "this is a test" >> "C:\myfile.txt"

Here is the another way to do the same:

>> "C:\myfile.txt" ECHO "this is a test"

From a batch-script this also work, but
I don't know if it does it from DOS ??!!


0

Response Number 3
Name: Doug
Date: October 17, 2002 at 07:40:34 Pacific
Reply:

copy con filename.txt
This will be in my text file
^Z

Control (^)-Z ends the session.
Everything you typed after the copy command was executed up to the CTRL-Z will be in the file: filename.txt


0

Response Number 4
Name: Secret_Doom
Date: October 17, 2002 at 11:26:18 Pacific
Reply:

Doug, Sondre said "hopefully at the end of the document". It seems to me that he wants to append the string, leaving what's already on the file there.

Sondre, on Dougs example, as he said, everything you type will be on the file, but nothing more. If anything else was there, it will be erased.

-- Leonardo Pignataro - Secret_Doom --

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


0

Response Number 5
Name: hukre
Date: October 18, 2002 at 17:56:44 Pacific
Reply:

How about using the built-in DOS editor?
At the DOS prompt, type the following:
edit blahblah.txt.
The text file will be displayed ready for editing.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






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: how to write a string to a txt file

Printing to a .TXT file from a DOS www.computing.net/answers/dos/printing-to-a-txt-file-from-a-dos-/11692.html

Password for a *.txt file www.computing.net/answers/dos/password-for-a-txt-file/7767.html

list a txt file from another drive www.computing.net/answers/dos/list-a-txt-file-from-another-drive/15650.html