Computing.Net > Forums > Disk Operating System > Insert String

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.

Insert String

Reply to Message Icon

Name: Prince
Date: February 18, 2001 at 05:09:09 Pacific
Comment:

Can someone teach me to insert string to every line of a textfile?
For example - the textfile goes like this:
1.zip
2.zip
3.zip
Then the final product should give:
del 1.zip
del 2.zip
del 3.zip
Is that possible? Please Help. Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Laurence
Date: February 18, 2001 at 05:24:50 Pacific
Reply:

Study this model. Comment out the DEL statement and examine the temporary batches it produces, then you will have your answer.

:: deltmps.bat
@ECHO off
SET quote=
IF not "%winbootdir%"=="" IF not "%windir%"=="" set quote="
ECHO @PROMPT DEL %quote%>%temp%.\deltmp1.bat
DIR/A-D/B/O/S c:\*.tmp >>%temp%.\deltmp1.bat
CTTY nul
%COMSPEC%/C%temp%.\deltmp1.bat |FIND ":\">%temp%.\deltmp2.bat
CTTY con
CALL %temp%.\deltmp2.bat
DEL %temp%.\deltmp?.bat
Batfiles: The DOS batch file programming handbook



0

Response Number 2
Name: Ronin
Date: February 18, 2001 at 10:28:56 Pacific
Reply:

What happens if something goes wrong after CTTY nul? bummer :)

Hey!! my keyboard died and there's no display.... OH NO


0

Response Number 3
Name: prince
Date: February 18, 2001 at 17:31:29 Pacific
Reply:

Lawrence...this is so complicated.
It is that I just cut and paste the whole thing from your reply into a bat file called deltmps.bat and that's all? What should i type if my text file is called 1.txt?


0

Response Number 4
Name: Ronin
Date: February 19, 2001 at 10:22:26 Pacific
Reply:

Try something like

FOR %%A in (*.zip) DO DEL %%A


0

Sponsored Link
Ads by Google
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: Insert String

Inserting String into document www.computing.net/answers/dos/inserting-string-into-document/12196.html

Strings.com v2.6 www.computing.net/answers/dos/stringscom-v26/16115.html

cpi file bits continuous string www.computing.net/answers/dos/cpi-file-bits-continuous-string/15196.html