0
我已經寫了下面的代碼,除了其中一個變量超過200個字符之外,它能夠正常工作並進入下一行,將佈局搞亂。任何關於更好佈局的建議,如果其中一個變量很長,它仍然保留結構?powershell寫入日誌文件
$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"
正如你可以看到ive用一個例子更新了原來的問題。直到「這裏有很多東西 stuff3」,然後它會包裝到下一行。我希望所有東西都適合,如果它包裝到下一行,再次證明stuff1是正確的。希望我現在多做一點。謝謝 – resolver101 2012-04-12 19:15:49