Using Command-Line Arguments
Modifying a script at run time is an important time-saving, labor-saving, and flexibility-preserving technique. In many companies, first-level support is given the ability to run scripts but not to create scripts. The first-level support personnel do not have access to script editors, nor are they expected to know how to modify a script at design time. The solution is to use command-line arguments that modify the behavior of the script. In this manner, the scripts become almost like custom-written utilities that are edited by the user, rather than components that are modified via a series of switches and parameters. An example of this technique is shown in the ArgsShare.ps1 script.
The ArgsShare.ps1 script defines a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access