Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a script that I want to search through a file and add one line. It does this, but it also deletes all the lines that start with a ; (semicolon). Here is the script.
For /F "tokens=*" %%A in (C:\test.txt) Do (
Echo %%A>> C:\test.txt.tmp
If "%%A"=="PaperPaper=" (
Echo PrinterPort=\\store%STOREID%\lexmark>> C:\test.txt.tmp))
Move C:\test.txt.tmp C:\test2.txtNot sure what I am doing wrong. I have tried to set the delmis to a random character to overwrite the defaults, but it still does the same thing.
It throws out lines that look like this:
;----------------------Here Blah blah
; MS-TestThanks for the help ahead of time guys.

Thanks, that works great. Is there a way I could get it to encompass the blank lines also? I would like to copy every single line, blank or not.

![]() |
For /l
|
Batch Check File is Opene...
|

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