Skip to content

Instantly share code, notes, and snippets.

@BirkhoffLee
Last active September 26, 2016 09:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BirkhoffLee/742b3a09a1fdd9b2b27223e0b61d6599 to your computer and use it in GitHub Desktop.
Save BirkhoffLee/742b3a09a1fdd9b2b27223e0b61d6599 to your computer and use it in GitHub Desktop.
Kick everyone in the public session of GTA Online.
@echo off
CLS
if "%minimized%"=="" set minimized=true & start /min cmd /c "%~dpnx0" & goto :EOF
:init
setlocal DisableDelayedExpansion
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & pushd .
cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
REM Run shell as admin (example) - put here code as you like
echo Disabling Local Area Connection Interface...
netsh interface set interface name="乙太網路" admin=disabled
echo Waiting GTA Online's timeout to kick all players...
ping 127.0.0.1 -n 5 > nul
echo Enabling Local Area Connection Interface...
netsh interface set interface name="乙太網路" admin=enabled
@BirkhoffLee
Copy link
Author

Auto-elevate code by http://stackoverflow.com/a/12264592/2465955, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment