Advertisement
CircusDad

JJs_Reset_n_Run_Tool.cmd

Dec 23rd, 2017
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.36 KB | None | 0 0
  1. @echo off
  2. :: BatchGotAdmin
  3. :: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
  4. ::-------------------------------------
  5. REM  --> Check for permissions
  6. >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
  7.  
  8. REM --> If error flag set, we do not have admin.
  9. if '%errorlevel%' NEQ '0' (
  10.     echo Requesting administrative privileges...
  11.     goto UACPrompt
  12. ) else (
  13.     goto gotAdmin
  14. )
  15.  
  16. :UACPrompt
  17.     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  18.     set params = %*:"="
  19.     echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
  20.  
  21.     "%temp%\getadmin.vbs"
  22.     del "%temp%\getadmin.vbs"
  23.     exit /B
  24.  
  25. :gotAdmin
  26.     pushd %~DP0
  27. ::--------------------------------------
  28. TITLE JJs Reset and Run Tool for Vega
  29. ::
  30. :: Author: TheJerichoJones on GitHub
  31. ::
  32. :: Resets the Vega driver
  33. :: Runs whatever Miner you like with the options you define
  34. :: Run whatever VidTool you like with the options you define
  35. :: Waits for input
  36. :: Repeats the process
  37. ::
  38. :: #### Begin Variables ####
  39. ::
  40. :: Needs trailing backslash for MinerPath and VidTool1Path.
  41. :: Don't quote the path even if it has spaces. That is done at runtime.
  42. :: Actually don't quote any of these settings.
  43. ::
  44. SET MinerPath=.\
  45. SET MinerEXE=XMR-STAK.EXE
  46. SET MinerName=%MinerEXE:.EXE=%
  47. SET MinerOpts=--config config.txt.supportxmr
  48. :: Other Tools. Delete or remark if not used.
  49. SET VidTool1Path=.\
  50. SET VidTool1=OverdriveNTool.exe -p1Vega64
  51. ::
  52. :: #### End Variables ####
  53. ::
  54. :Start
  55. START /W PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Get-PnpDevice| where {$_.friendlyname -like 'Radeon RX Vega'} | Disable-PnpDevice -ErrorAction Ignore -Confirm:$false | Out-Null}"
  56. TIMEOUT /t 5
  57. START /W PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Get-PnpDevice| where {$_.friendlyname -like 'Radeon RX Vega'} | Enable-PnpDevice -ErrorAction Ignore -Confirm:$false | Out-Null}"
  58. IF DEFINED VidTool1 (
  59.     START /W %VidTool1Path%%VidTool1%
  60. )
  61. Start "JJs Reset and Run Tool for Vega running %MinerName%" "%MinerPath%%MinerEXE%" %MinerOpts%
  62. CLS
  63. echo.
  64. echo ****************************************
  65. echo * Press any key to restart the script. *
  66. echo ****************************************
  67. echo.
  68. pause>nul
  69. echo.
  70. Taskkill /im %MinerEXE% /f
  71. echo.
  72. Goto :Start
  73. POPD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement