Hey PowerShellGuy!,How Can I Check to See if Two Lines of Text are in a File and, If They Are Not, Append Those Lines to the File?
| Translation to PowerShell of a Hey, Scripting Guy! column that shows you how to check a text file for specific lines containing double quote marks and add those lines if it they don't exist. |
$l = 'pref("general.config.obscure_value", 0);',
'pref("general.config.filename", "mozilla.cfg");'
$f = @(get-content all.js)
$l |% {if (-not($f -contains $_)) {$f += $_}}
set-content all.js $f
Enjoy,
Greetings /\/\o\/\/