How to turn off and turn on a single monitor from command line on Windows operating system

The ControlMyMonitor utility allows you to change the settings of your monitor from command-line and GUI.
In order to turn off a monitor using ControlMyMonitor, you can use the following command:
ControlMyMonitor.exe /SetValue "\\.\DISPLAY1\Monitor0" D6 5

The "\\.\DISPLAY1\Monitor0" is the name of the monitor that you want to turn off. You should look at the main window of ControlMyMonitor to check what is the name of the monitor that you need to turn off. You can also specify the ID or serial number of the monitor instead of name. The 'D6' specifies the VCP Code for Power mode. For every monitor setting there is a different VCP Code.
If you have only one monitor or you want to turn off the primary monitor, you can specify 'Primary' instead of monitor name, for example:
ControlMyMonitor.exe /SetValue "Primary" D6 5

If this command doesn't work properly with your monitor, you can try to specify '4' instead of 5:
ControlMyMonitor.exe /SetValue "\\.\DISPLAY1\Monitor0" D6 4

If you want to turn on the monitor, simply set the D6 code (Power Mode) to 1, for example:
ControlMyMonitor.exe /SetValue "\\.\DISPLAY2\Monitor0" D6 1

If you want to switch between on and off state, you can use the /SwitchValue command, for example:
ControlMyMonitor.exe /SwitchValue "\\.\DISPLAY2\Monitor0" D6 1 5

Be aware that ControlMyMonitor will work on your system only if your hardware supports DDC/CI, and you have Windows Vista or later version of Windows (Including Windows 10). Windows XP is not supported.