Created
November 10, 2023 10:17
-
-
Save CodeFoxy-Github/a2fed9e6108dc2eb92a50b60b33f63a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Echo off | |
:: Check for permissions | |
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" | |
:: If error flag set, we do not have admin. | |
if '%errorlevel%' NEQ '0' ( | |
Echo Requesting administrative privileges... | |
goto UACPrompt | |
) else ( goto gotAdmin ) | |
:UACPrompt | |
Echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" | |
Echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" | |
"%temp%\getadmin.vbs" | |
Exit /B | |
:gotAdmin | |
if exist "%temp%\getadmin.vbs" ( Del "%temp%\getadmin.vbs" ) | |
Pushd "%CD%" | |
CD /D "%~dp0" | |
C:\Windows\System32\notepad.exe C:\Windows\System32\drivers\etc\hosts | |
set hostspath=C:\Windows\System32\drivers\etc\hosts | |
echo 127.0.0.1 www.youtube.com >> %hostspath% | |
echo 127.0.0.1 youtube.com >> %hostspath% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment