0
我嘗試沒有成功運行下一個腳本:如何查找文件並根據內容添加新行?
1.try找到下d所有.properties文件:\ 如果文件內容包括「IIS」,然後追加一個單獨的兩行到 文件。
和
2.try找到所有.prop2文件在C:\ 如果文件內容include'win88' 追加一個單獨的兩行的文件。
腳本:
$file1 = Get-ChildItem -Path D:\* -Filter *.properties -Recurse
$file2 = GetChildItem -Path C:\* -Filter *.prop2 -Recurse
if ($file1 -contains '*iis*') {Add-Content $file1 "'nServer1'nServer2"};
if ($file2 -contains '*win88*') {Add-Content $file2 "'nServer3'nServer4"};