我是PowerShell的新手,并且在循环中连接字符串,如果发生特殊情况,我应该插入换行符...我该怎么做?
基本上寻找的等价物\n
。
$str = ""
foreach($line in $file){
if($line -Match $review){ #Special condition
$str += ANSWER #looking for ANSWER
}
#code.....
}
到目前为止,我已经尝试过
"\n" '\n' "\N" '\N' "\r" '\r' "\R" '\R' '`n' '`r' '-n' '-r'
The term ' ' is not recognized as the name of a cmdlet, function, sc....