JFLarvoire / SysToolsLib

A library of Windows and Linux system management tools
Apache License 2.0
314 stars 93 forks source link

PSService.ps1 Question #26

Closed johndoe99 closed 3 years ago

johndoe99 commented 3 years ago

I have a script that requires to arguments to be passed in at the command line when the script is run. Is that possible with this script and if so how would I go about doing it?

JFLarvoire commented 3 years ago

By definition, a service starts up automatically. So you can't pass it command-line parameters. But you can define a configuration file, that it reads when it starts, and that contains user-defined parameters. Alternatively, you can store options in the registry.