Echo equivalent in PowerShell for script testing

前端 未结 11 1581
梦如初夏
梦如初夏 2020-12-07 10:08

I would like to output variables and values out in a PowerShell script by setting up flags and seeing the data matriculate throughout the script.

How would I do thi

11条回答
  •  感动是毒
    2020-12-07 10:23

    It should also be mentioned, that Set-PSDebug is similar to the old-school echo on batch command:

    Set-PSDebug -Trace 1
    

    This command will result in showing every line of the executing script:

    When the Trace parameter has a value of 1, each line of script is traced as it runs. When the parameter has a value of 2, variable assignments, function calls, and script calls are also traced. If the Step parameter is specified, you're prompted before each line of the script runs.

提交回复
热议问题