How do I provide param attributes for a script in PowerShell?

前端 未结 2 1067
臣服心动
臣服心动 2020-12-30 02:26

I have this script that can be called in two ways:

MyScript -foo path\\to\\folder

or

MyScript -bar path\\to\\folder
         


        
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 03:21

    As explained here you can specify the parameter position of your parameter.

    [parameter(Position=0)]
    

提交回复
热议问题