How to pass needed parameters to script in Powershell ISE?

后端 未结 4 419
别跟我提以往
别跟我提以往 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:17

    There is a much simpler way to set needed Parameters in ISE:

    Before pressing F5 in ISE, set the Parameter you need. I usually comment the Parameter I need, example: # $G_ARCHIVE = "C:\Temp\TestFile_001.txt"

    I select everything after "#" and press F8. Next time I debug the script with F5, the Parameter is set to the value I am testing with, no need to pass the Parameters through the command line.

提交回复
热议问题