There is a program called NirCmd that allows you to control various aspects of Windows using this command-line program. For example, after adding the program to
PATH or the same folder where my Python script is saved, I can type:
import os os.system("nircmdc.exe muteappvolume myProgram.exe 1") # this mutes the program
to mute a program. Similarly, changing the 1 to a 0 will unmute the program. Similarly, I can also type:
import os os.system("nircmdc.exe setappvolume myProgram.exe 65535") # this makes the program full volume
to set a program’s volume, where 65535 can be any integer between 0 and 65535. This program simply controls the native Windows volume mixer that you can open by right-clicking the volume icon in the system tray. This works just fine, but NirCmd has many, many other commands that I don’t need. Is there a way I can control the Windows volume mixer from Python without downloading additional software?