2013-10-04 16 views

回答

3

命令行參數默認存儲在數組中。該數組是$ args []。如果你想要命名參數,使用param()。如果您想爲同一參數指定多個參數,請使用逗號。

示例代碼:

function myprogram { 
    param (
     [string[]]$file 
    ) 
    #Do stuff to $file array here 
} 

命令行:

myprogram -file file1,file2,file3 
+0

非常感謝! –