Advertisement
Guest User

Untitled

a guest
Feb 9th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. @echo off
  2.  
  3. :: BatchGotAdmin
  4. :-------------------------------------
  5. REM --> Check for permissions
  6. IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
  7. >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
  8. ) ELSE (
  9. >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
  10. )
  11.  
  12. REM --> If error flag set, we do not have admin.
  13. if '%errorlevel%' NEQ '0' (
  14. echo Requesting administrative privileges...
  15. goto UACPrompt
  16. ) else ( goto gotAdmin )
  17.  
  18. :UACPrompt
  19. echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  20. set params= %*
  21. echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
  22.  
  23. "%temp%\getadmin.vbs"
  24. del "%temp%\getadmin.vbs"
  25. exit /B
  26.  
  27. :gotAdmin
  28. pushd "%CD%"
  29. CD /D "%~dp0"
  30. :--------------------------------------
  31. taskkill /f /im qbittorrent.exe
  32. start /d "C:\Program Files\qBittorrent" qbittorrent.exe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement