Having the microphone volume level reset to 100 every time after you change it is pretty irritating; specially if you use your microphone a lot. This problem seems to be very common in Windows machines and there are no fixes for it. I’m going to teach a script to fix this issue.
This tutorial is going to be done with a Windows command line tool called “NirCmd” which exists in the System32 folder of your windows installation by default.
First of all, make sure that “NirCmd” exists:
Run CMD as Administrator by searching “cmd” and then right clicking and choosing “Run as Administrator”:
After that, you’ll be given a command line interface where you can enter commands. Type in “nircmdc”; if the result is anything like the given picture, then you have “NirCmd” and we can move on:
Writing The Script:
Now that we know that “NirCmd” exists, we can move on to writing the batch script and make it run on startup!open up notepad and copy the following text inside it:
if not "%minimized%"=="" goto :minimized set minimized=true start /min cmd /C "%~dpnx0" goto :EOF :minimized cd /Windows/System32/ nircmdc.exe loop 172800 100 setsysvolume 57016 default_record
After you copied this to notepad, go to “File”, tap “Save As” then enter the name as “mic_locker.bat”(any name with a .bat suffix) and “Save as Type” to “All Files *.*” and save it to desktop for testing:
Since I provided code in this article, it wouldn’t hurt to explain the code, so you can customize it!
The first 5 lines are used to minimize the CMD window when you launch the script, this prevents so many headaches you might have when making this script run at startup.
The 6th line is used to change the working directory to “/Windows/System32” so we can use the nircmdc command!
The last line is used to use the nircmdc command to change the “Default Microphone’s” volume every 100 milliseconds to 57016 or 87%.
So 100 stands for every 100 milliseconds. The full volume is 65535; so if you want 87%, you multiply it by 87/100 . That’s all you need for customizing the script.
Adding The Script To Startup
Now that we wrote and saved the script, we need to put it in the startup folder; So that it will start locking the Microphone Level whenever we login to windows!
This is done by Copying this script into the Startup Folder which is “C:\ProgramData\Microsoft\Windows\Start Menu\Programs” and after this, the script will start running and locking the microphone level to the percentage of your choice.
I found this method first on Here but it stopped working after a while for some reason; so I rewrote the script to make it work on startup.