How do I output text without a newline in PowerShell?

前端 未结 17 2328
独厮守ぢ
独厮守ぢ 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:49

    The following will place the cursor back at beginning of the previous row. It's up to you to place it in the right horizontal position (using $pos.X to move it sideways):

    $pos = $host.ui.RawUI.get_cursorPosition()
    $pos.Y -= 1
    $host.UI.RawUI.set_cursorPosition($Pos)
    

    Your current output is 27 spaces over, so $pos.X = 27 might work.

提交回复
热议问题