How to pass needed parameters to script in Powershell ISE?

后端 未结 4 430
别跟我提以往
别跟我提以往 2021-02-03 16:41

See Title.

I specified needed parameters in the head of a script:

param ($G_ARCHIVE = $(throw \"Need file to upload!\"),
       $G_LOGFILE = $(throw \"Ne         


        
4条回答
  •  故里飘歌
    2021-02-03 17:16

    1. Open the script (myscript.ps1) in Windows Powershell ISE
    2. Press F9 at the variable you want to inspect (debug). For instance 2nd line in the sample below where the $outputText variable is being assigned
    3. In the shell window provide the relative path of the script along with the param value. For instance: .\myscript.ps1 "my value"
    4. Hit enter (you don't need to hit F5)
    5. You'll be able to see the debugging breakpoints in highlighted with yellow color. Place your cursor to the desired variable to inspect the current value.

    A sample showing PowerShell debugging with ISE and command parameter

提交回复
热议问题