我编写了下面的代码,除了其中一个变量超过 200 个字符外,它工作正常,并进入下一行,弄乱了布局。关于更好的布局的任何建议,所以如果其中一个变量很长,它仍然保留结构?
$WriteLog = $null
$WriteLog = @()
$WriteLog +="Here is some stuff: $stuff1"
$WriteLog +="Here is some stuff: $stuff2"
$WriteLog +="Here is some stuff: $stuff3"
$WriteLog +="Here is some stuff: $stuff4"
$WriteLog +="Here is some stuff: $stuff5"
$WriteLog +="Here is some stuff: $stuff6"
Out-File -InputObject $WriteLog -Append -NoClobber -FilePath "$env:SystemDrive\somestuff\somestuff.txt"
示例输出:
"Here is some stuff: stuff1"
"Here is some stuff: stuff2"
"Here is some stuff: Heres a lot of stuff
stuff3, stuff3, stuff3, stuff3, stuff3, stuff3"
"Here is some stuff: stuff4"
"Here is some stuff: stuff5"
"Here is some stuff: stuff6"