Created
February 13, 2015 18:11
-
-
Save apa6ec/d6e667e12b4ebc61ae0c to your computer and use it in GitHub Desktop.
[Win] Fast Change hosts-file (smart shortcut)
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 | |
SetLocal EnableExtensions EnableDelayedExpansion | |
rem Simple text editor *.exe file | |
set editor=notepad | |
rem Hosts file path | |
set hosts=%SystemRoot%\System32\drivers\etc\hosts | |
echo Unset read-only | |
attrib -S -R %hosts% | |
rem Magic! Open on text-editor | |
echo Waiting for closing a text editor... | |
start /wait %editor% %hosts% | |
rem Set read-only attributes after close editor | |
echo Set read-only | |
attrib +R +S %hosts% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment