IF EXIST [string in file] THEN [command]
Posted: 05 Aug 2011 20:28
I'm making a batch file that will add a string to a file of it doesn't exist in that file. Is this possible?
A Forum all about DOS Batch
https://www.dostips.com/forum/
Code: Select all
findstr /c:"hello world" a.txt || echo hello world >>a.txt
Code: Select all
findstr /c:"hello world" a.txt >nul || echo hello world >>a.txt