From aeafdf686d06f2f6a3fec3e17d6487590070ca99 Mon Sep 17 00:00:00 2001 From: Adrian Groh Date: Sun, 22 Jan 2023 19:52:20 +0100 Subject: [PATCH] Add v2 script --- install.bat | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 install.bat diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..bc7554c --- /dev/null +++ b/install.bat @@ -0,0 +1,50 @@ +@echo off + +:: If not run as admin, open prompt +>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" + +if '%errorlevel%' NEQ '0' ( + goto UACPrompt +) else ( goto gotAdmin ) + +:UACPrompt + echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" + set params = %*:"=" + echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" + + "%temp%\getadmin.vbs" + del "%temp%\getadmin.vbs" + exit /B + +:gotAdmin + pushd "%CD%" + CD /D "%~dp0" + +:: install vbs script to %localappdata% +echo CreateObject("Wscript.Shell").Run "PowerShell.exe ""$Process = Get-Process audiodg; $Process.ProcessorAffinity=1; $Process.PriorityClass=""""""High""""""""", 0, True > %localappdata%\set-audiodg-affinity.vbs +:: Affinity table +::Core # = Value = BitMask +::Core 1 = 1 = 00000001 +::Core 2 = 2 = 00000010 +::Core 3 = 4 = 00000100 +::Core 4 = 8 = 00001000 +::Core 5 = 16 = 00010000 +::Core 6 = 32 = 00100000 +::Core 7 = 64 = 01000000 +::Core 8 = 128 = 10000000 + +:: remove old version of program if present +cd C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ +del set-audiodg-affinity.bat 2>NUL + +:: add task scheduler job +schtasks /create /sc ONLOGON /tn audiodg-affinity /tr %localappdata%\set-audiodg-affinity.vbs /rl HIGHEST + +:: Uninstall with +:: schtasks /delete /f /tn audiodg-affinity + +echo. +echo. +echo INSTALLATION FINISHED +echo. +pause