How to prompt for user input and read command-line arguments

To read user input you can try the cmd module for easily creating a mini-command line interpreter (with help texts and autocompletion) and raw_input (input for Python 3+) for reading a line of text from the user. Command line inputs are in sys.argv. Try this in your script: There are two modules for parsing command line options: (deprecated since Python 2.7, use argparse instead) and getopt. If … Read more

How to handle command-line arguments in PowerShell

You are reinventing the wheel. Normal PowerShell scripts have parameters starting with -, like script.ps1 -server http://devserver Then you handle them in param section in the beginning of the file. You can also assign default values to your params, read them from console if not available or stop script execution: Inside the script you can simply since all parameters … Read more