Different from: How to handle command-line arguments in PowerShell
What's the best way to handle an unnamed command-line argument in a powershell script?
For example, I have a powershell script that I would like to run as
.\test.ps1 L3
and have an error if L3 is not supplied. I don't want to have to run it as:
.\test.ps1 -lab L3
My current script:
$args[0]
does not cause an error if the argument is omtted.
This looks promising, haven't tried it yet: https://technet.microsoft.com/en-us/library/hh847743.aspx * Edit: * The promising link is useful -- I used it to form all my examples