How do I output text without a newline in PowerShell?

前端 未结 17 2283
独厮守ぢ
独厮守ぢ 2020-12-07 15:13

I want my PowerShell script to print something like this:

Enabling feature XYZ......Done

The script looks something like this:



        
17条回答
  •  攒了一身酷
    2020-12-07 15:44

    While it may not work in your case (since you're providing informative output to the user), create a string that you can use to append output. When it's time to output it, just output the string.

    Ignoring of course that this example is silly in your case but useful in concept:

    $output = "Enabling feature XYZ......."
    Enable-SPFeature...
    $output += "Done"
    Write-Output $output
    

    Displays:

    Enabling feature XYZ.......Done
    

提交回复
热议问题