Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Restart Windows Audio Service (with admin permissions, if needed)
rem Written for buggy audio drivers that need to be restarted
rem In my case, the Claro 8.18 drivers bug out every once in a while on Windows 10, and need restarting to not sound poppy
@echo off
goto check_Permissions
echo Administrative permissions required to run this script. Checking...
net session >nul 2>&1
if %errorLevel% == 0 (
goto gotAdmin
) else (
goto UACPrompt
pause >nul
pushd "%CD%"
CD /D "%~dp0"
net stop audiosrv /y
net stop AudioEndpointBuilder /y
net start audiosrv
net start AudioEndpointBuilder
rem This next line is just for my configuration, or anyone else that has Razer headphones
net start RzSurroundVADStreamingService
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment