Categories
Howto

How to lock the Microphone Volume Level in Windows

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.

checking if nircmd exists by typing nircmdc in cmd

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 nircmdc together.

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!

Subscribe
Notify of
guest
39 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
tony eastwood

RE: Windows command line tool called “NirCmd”. NirSoft provide this, (and many other) handy utilities, they don’t come as part of windows 10. It is a simple download.

Michael

Thank you very much, I couldn’t change the volume options in MS Teams with my blue yeti microphone.

Kormoci Csaba

The .bat window isn’t hide after startup. What should I do?

Kormoci Csaba

Thank you very much!
Here “%USERPROFILE%\AppDataRoaming\Microsoft\Windows\Start Menu\Programs\Startup” you missed a “\” after AppData. 😛

Walter

I encountered some rather odd speaker issues while on a Zoom call and I decided to delete all the programs I was using to lock the mic volume. I successfully deleted the .vbs file and nircmdc but wscript.exe says it can’t be deleted without the permission of “TrustedInstaller”. I couldn’t find any tutorials on deleting the .exe that were compatible with Windows 10 and I was hoping you could provide some insight.

Jesse

wscript is stock Windows software. Do not delete it. Sounds like your operating system is trying to prevent you from deleting one of many important stock system files and programs. Nircmdc is fine to delete, but there’s a reason why it’s stopping you from deleting wscript!

Raffy Florentino

LOl even with this my microphone volume still auto-adjusts because of chrome. It’s true that this command helps the volume stays locked up to my desired level but then it still adjusts from time to time then go back to the locked volume. lol This has been an ongoing problem with Chrome.

Last edited 3 years ago by Raffy Florentino
Sean

The only volume setting this ever sets my microphone to is 0, even when I’ve made no changes to the raw copied script. Is there a value somewhere I should be changing?

Sean

Running that in cmd sets the volume to 87 correctly. Which is strange because running the script through notepad doesn’t do that.

Last edited 3 years ago by Sean
Sean

I just tried running the script again and now it works. I have no idea what’s changed but I’m glad it works now.

Sartaj Khan

Hi,
Thanks for sharing this information. I have done it in my windows 10 pro on my laptop. But I have a desktop running windows 7 ultimate service pack1, And I want to do this in my desktop. So the problem is this that this path “%USERPROFILE%\AppData\Local\Microsoft\WindowsApps”
is not available same to same in my desktop. It last folder is Microsoft and there is no WindowsApp folder available. Please help me how to do this in my desktop. Thanks.

Sartaj Khan

It worked man! Thanks very much. I was really bothered with this windows problem of automatically adjusting the volume of mic. I have seen many videos on youtube and read some articles on web as well but couldn’t find solution anywhere. The way you have written this article is really eye catchy, very simple to understand and implement without needing any further help. Thank you so much bro. Take Care.

Sartaj Khan

One more thing I would like to ask you brother. In my windows 7 ultimate I have the option to end process tree and I can edit it easily according to my choice. But in windows 10 pro when I click on task manager under processes it is only showing NirCmd(32 bit) and when I right click on it there is no option like “end process tree”, It has the option “end task” only and in the same task manager there is one more column “Startup” and it has mic_locker and it has the option of enable and disable. So… Read more »

Sartaj Khan

Ya it’s working now I can edit in windows 10 pro as well. Thanks!!

Sartaj Khan

In windows 10 pro in task manager in Details column it is not showing wscript.exe option.

Rimvis

This is a life saver. Imagine having a studio XLR mic, using it for conference calls, facebook calls, Discord ect. and the mic level randomly jumping from 50 to 100. I literally had to keep Microphone Properties open to check if my volume didn’t jump to 100, when I usually use 70…

Matthew

I’ve been finding a solution to windows 10 auto adjusting mic vol for a few weeks. By adjusting the ms of this script, It solved my problem. Thank you!

wilson

I get this error while following the instructions. Is there something I should be doing otherwise?

Screenshot 2022-12-02 132540.png
wilson

Like in step 2? Do you mean saving the script to the wrong location or do I have to change something in the script itself? I retraced everything and it seems like I followed all the steps correctly.

wilson

It seems like nircmd is installed based on this.

Screenshot 2022-12-04 143155.png
wilson

Sorry, I’m not too technical I don’t really know what this means.

wilson

I think this is it? Also ran nircmdc normally but still get the same error.

Screenshot 2022-12-07 003020.png
wilson

Copying the files to system 32 did the trick. Thank you for your patience in helping me!

RandomUser275247

thx very much for this guide
10/10

TheBeefLord

Man you saved me, I used to have an older version of a script i found on yt and worked fine for months but since I put windows LTSC it wouldn’t work anymore properly like it would close down on its own after a while, I even changed my sound interface because of that just in case my cheap behringer was doing something but…to no avail it happened again and again, now this one been tested and works so good, THANK YOU.