Download and run ControlMyMonitor from https://www.nirsoft.net
Identify the monitor to control in the gui, and then run the command parameters from the command line. Input Select parameter allows you to choose the input from the command line from the list of available input values.
Parameter 60 controls the input selection (ie VGA, HDMI1, HDMI2, DisplayPort, DVI). Use Trial and error to determine which # is associated with the input.
For example:
To set the monitor to the Input HDMI #1
.\ControlMyMonitor /setvalue \\.\DISPLAY2\Monitor0 60 17
To set the monitor to the Input DisplayPort #1
.\ControlMyMonitor /setvalue \\.\DISPLAY2\Monitor0 60 15