Computing.Net > Forums > Windows NT > How to add text in a batch 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 add text in a batch File

Reply to Message Icon

Name: jdk981
Date: April 13, 2009 at 08:26:01 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hello,

I have a file (test.txt) and I need to add text as "wait" on alternate line on above test.txt file. Please some one help me how to do it in batch file.

Example:
TEST.TXT
Stephen Alex
Vince Richard
Harrison Andrew

If we add "WAIT" text, result should be
RETEST.TXT

Stephen Alex
WAIT
Vince Richard
WAIT
Harrison Andrew
WAIT


Thanks,
jdk981



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: April 15, 2009 at 01:32:08 Pacific
Reply:

@echo off > newfile

for /f "tokens=* delims=" %%a in (test.txt) do (
echo %%a >> newfile
echo WAIT >> newfile
)


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

M2


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: How to add text in a batch File

Logon to Windows NT with a Batch File www.computing.net/answers/windows-nt/logon-to-windows-nt-with-a-batch-file/1498.html

using a WAIT command in a batch file www.computing.net/answers/windows-nt/using-a-wait-command-in-a-batch-file/15784.html

SMTP from a batch file www.computing.net/answers/windows-nt/smtp-from-a-batch-file/16828.html