Advertisement
FadeMind

audio-fix.cmd

Mar 2nd, 2024
1,424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. :: Check if we are an administrator. If not, exit immediately.
  3. :: BatchGotAdmin
  4. :: Check for permissions
  5. if "%PROCESSOR_ARCHITECTURE%" equ "amd64" (
  6.     >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
  7. ) else (
  8.     >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
  9. )
  10.  
  11. :: If the error flag set, we do not have admin rights.
  12. if %ERRORLEVEL% neq 0 (
  13.     echo Requesting administrative privileges...
  14.     goto UACPrompt
  15. ) else (
  16.     goto gotAdmin
  17. )
  18.  
  19. :UACPrompt
  20. echo Set UAC = CreateObject^("Shell.Application"^) > "%TEMP%\getadmin.vbs"
  21. set params= %*
  22. echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%TEMP%\getadmin.vbs"
  23.  
  24. wscript.exe "%TEMP%\getadmin.vbs"
  25. del "%TEMP%\getadmin.vbs"
  26. exit /b
  27.  
  28. :gotAdmin
  29. cd /d "%~dp0"
  30.  
  31. :audiofix
  32. net stop RtkAudioUniversalService
  33. net stop audiosrv
  34. net start audiosrv
  35. net start RtkAudioUniversalService
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement