Skip to content

Commit

Permalink
Create open_hosts.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
ajb3296 authored Feb 3, 2020
1 parent c94b82c commit ff66b31
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions AfW_Option/open_hosts.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
:startadmine
>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"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"

start notepad.exe "C:\Windows\System32\drivers\etc\hosts"
exit

0 comments on commit ff66b31

Please sign in to comment.