Wrapper function in PowerShell: Pass remaining parameters
问题 I’m trying to write a wrapper function in PowerShell that basically evaluates the first parameter and based on that runs a program on the computer. All the remaining parameters to the wrapper function should then be passed to the program that is ran as well. So it should look something like this: function test ( [string] $option ) { if ( $option -eq 'A' ) { Write-Host $args } elseif ( $option -eq 'B' ) { . 'C:\Program Files\some\program.exe' $args } } Now just adding $args does not work, so