I have a .ps1 that calls down files and if it can't call down the files, it will look locally for those files. I'd like to give the option, as a parameter, to either work locally or go fetch from the internet and also specify which of the 5 files to use or call down. I'm made the script work with a "local" and "external" function, but how do I also add parameters to those functions?
For example:
./script.ps1 -local file1,file2,file3
or
./script.ps1 -external file4,file5
Here is my code currently:
Param(
[Parameter(Position=1)][string]$option
)
function RunLocal {
Write-Host "local"
}
function RunExternal {
Write-Host "ext"
}
function RunDefault {
Write-Host "default"
}
switch ($option) {
local { RunLocal }
external { RunExternal }
default { RunDefault }
}