Powershell add-content line breaks

后端 未结 3 371
死守一世寂寞
死守一世寂寞 2021-01-18 01:53

I am trying to figure out how to eliminate line breaks when using add-content

echo $server \"Uptime: \" $uptime.days \", Days\" $uptime.hours \", Hours\" $up         


        
3条回答
  •  耶瑟儿~
    2021-01-18 02:40

    The simplest way to sidestep any problem PowerShell might be putting into the line breaks would be to avoid using the providers.

    By using [IO.File]::WriteAllText to write the file, you should be able to avoid the linebreaks that come from PowerShell. The only caveat is that [IO.File]::WriteAllText doesn't understand PowerShell paths, so you'll need to pass it an absolute path.

    Hope this helps,

提交回复
热议问题