English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Howto append "Written by John Smith" to all text files on a computer that don't have "Written by John Smith" in it already.

2007-04-22 16:55:27 · 1 answers · asked by jm45nt 1 in Computers & Internet Programming & Design

1 answers

Use the "for" command to take the output of "dir" and pipe it through "find" to look for the "Written by John Smith" string. If the 'find' fails to find the string in the file, then echo the string into the file. This is on one line,

for /f "tokens=*" %f in ('dir *.txt /b /s') do find /i "Written by John Smith" "%f" || echo Written by John Smith>>"%f"

2007-04-23 14:36:06 · answer #1 · answered by Kevin 7 · 3 0

fedest.com, questions and answers