Skip to content
This repository was archived by the owner on Sep 2, 2019. It is now read-only.

Commit 39ac5b3

Browse files
authored
Update runact.bat
1 parent 3f060fe commit 39ac5b3

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

runact.bat

+34-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,37 @@ del /q "%TEMP%\UAC.vbs"
2525
cd "%~p2"
2626

2727
::put your main script here
28-
netsh firewall add allowedprogram "%~0dp\Advanced Combat Tracker.exe" ACTv3 ENABLE
29-
netsh advfirewall firewall add rule name=¡±ACTv3¡± dir=in action=allow program="%~0dp\Advanced Combat Tracker.exe" enable=yes
30-
"Advanced Combat Tracker.exe"
28+
netsh firewall add allowedprogram "%~dp0p\Advanced Combat Tracker.exe" ACTv3 ENABLE
29+
netsh advfirewall firewall add rule name="ACTv3" dir=in action=allow program="%~dp0p\Advanced Combat Tracker.exe" enable=yes
30+
@echo off
31+
::Windows XP doesn't have UAC so skip
32+
for /f "tokens=3*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName ^| "%SYSTEM%Find" "ProductName"') do set WINVER=%%i %%j
33+
echo %WINVER% | find "XP" > nul && goto commands
34+
::prompt for elevation
35+
if "%1" == "UAC" goto elevation
36+
(
37+
echo Set objShell = CreateObject^("Shell.Application"^)
38+
echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
39+
echo strPath = objFSO.GetParentFolderName^(WScript.ScriptFullName^)
40+
echo If objFSO.FileExists^("%~dpnx0"^) Then
41+
echo objShell.ShellExecute "cmd.exe", "/c """"%~dpnx0"" UAC ""%~dp0""""", "", "runas", 1
42+
echo Else
43+
echo MsgBox "Script file not found"
44+
echo End If
45+
) > "%TEMP%\UAC.vbs"
46+
cscript //nologo %TEMP%\UAC.vbs
47+
goto :eof
48+
:elevation
49+
del /q "%TEMP%\UAC.vbs"
50+
51+
:commands
52+
::navigate back to this script's home folder
53+
%~d2
54+
cd "%~p2"
55+
@echo on
56+
::put your main script here
57+
netsh advfirewall firewall delete rule "name=ACTv3"
58+
netsh firewall add allowedprogram "%~dp0Advanced Combat Tracker.exe" ACTv3 ENABLE
59+
netsh advfirewall firewall add rule name="ACTv3" dir=in action=allow program="%~dp0Advanced Combat Tracker.exe" enable=yes
60+
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%~dp0Advanced Combat Tracker.exe" /t REG_SZ /d "~ RUNASADMIN" /f
61+
pause

0 commit comments

Comments
 (0)