How to pass command-line arguments to a PowerShell ps1 file

前端 未结 7 888
Happy的楠姐
Happy的楠姐 2020-12-12 23:21

For years, I have used the cmd/DOS/Windows shell and passed command-line arguments to batch files. For example, I have a file, zuzu.bat and in it,

7条回答
  •  甜味超标
    2020-12-12 23:55

    You could declare your parameters in the file, like param:

    [string]$para1
    [string]$param2
    

    And then call the PowerShell file like so .\temp.ps1 para1 para2....para10, etc.

提交回复
热议问题