简体   繁体   中英

out put to a file all on one line powershell

Code -

Write-Output "No. Excluded files:" $Global:exclusioncount | Out-File DryRun.txt -append

However the variable gets outputted on a different line. Is there anyway to make it output on the same line?

Here are three ways you could solve this:

Write-Output ("No. Excluded files:{0}" -f $Global:exclusioncount) | Out-File DryRun.txt -append

Write-Output "No. Excluded files:$($Global:exclusioncount)" | Out-File DryRun.txt -append

Write-Output ("No. Excluded files:" + $Global:exclusioncount) | Out-File DryRun.txt -append

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM