Like in C and other languages, you can give to the script/.exe arguments when you physically execute the script. For example:
myScript.exe Hello 10 P
Whereby Hello, 10 and P are passed to some variable in the program itself.
Is this possible in Powershell? and if so, how do you give those args to a given $variable
Thanks!
Define your script with a param block like so:
You can further type qualify parameters as well e.g:
You can also specify default values and required values e.g.:
You can get even fancier with advanced functions (specify attributes to validate parameters, etc). But this should get you going.