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 get around this issue using nircmd.
1. Installing NirCmd
NirCmd can be installed from NirSoft’s website or directly from https://www.nirsoft.net/utils/nircmd.zip.
After downloading it, copy the
nircmdc file from the zip you downloaded and paste it into
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps (The directory defined in user’s PATH environment variable). Now
nircmdc is installed!
Search for and open cmd. You’ll be given a command line interface. Type in
nircmdc and press enter; if the result is anything like the given picture, then “NirCmd” is installed and we can move on:
NOTE: This process does not require administrator privileges.
2. The script and startup
Now that we know that
nircmdc is installed, we can move on to writing the vbs script and make it run on startup! Open up notepad and copy the following code inside it:
Set objShell = WScript.CreateObject("WScript.Shell") Do While True objShell.Run("nircmdc loop 172800 1000 setsysvolume 57016 default_record"), 0, True Loop
After you copied this to notepad, go to “File”, tap “Save As” then enter the name as “mic_locker.vbs” (any name with a .vbs suffix) and set “Save as Type” to “All Files” and save it to
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup for startup:
3. Script explained
This script runs a while true loop and calls
nircmdc in it which runs a loop as well. This will decrease how many times
nircmdc is called; In turn having very low cpu usage.
The main command used is
nircmdc loop 172800 1000 setsysvolume 57016 default_record. The
nircmdc command changes the “default record device” volume/level every second for 172800 times to 57016 or 87%.
The full volume is 65535; so if you want 87%, you multiply 65535 by 0.87(%87); giving us 57016. That’s all you need for customizing the script.
Full nircmdc manual is available here: https://www.nirsoft.net/utils/nircmd2.html#using
4. Killing the script and re-executing it
If you want to change the volume manually or change the values of the command, you need to kill it first.
Do this by going to
Task manager -> Details ; then sort by name, find
wscript.exe and right-click and
End process tree to kill the script and
For re-execution, all you need to do is going to
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup and executing the script again. No windows appear, no hassle!