Missing args (#225)
authorcrazy-max <redacted>
Thu, 22 Dec 2016 15:30:26 +0000 (16:30 +0100)
committercrazy-max <redacted>
Thu, 22 Dec 2016 15:30:26 +0000 (16:30 +0100)
Add title to bat windows

makeHostsWindows.bat
readme.md
updateHostsWindows.bat

index f5816d5d2fb48003f6c28f044760136cad63fe59..fbfc6802ad8850a947e1350f223f2cae86d1e1b4 100644 (file)
@@ -1,4 +1,5 @@
 @ECHO OFF
+TITLE Make Hosts
 
 if not exist "%WINDIR%\py.exe" (
        ECHO :: ERROR :: Python 3.5 Runtime NOT FOUND...
index fa0a92af7bb6abd6cf67173430912f1416d8aae7..5951f8927e3254aee9cda5a5ce21c0b2b40a55e5 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -225,7 +225,7 @@ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
 |`makeHostsWindows.bat` BATCH file will create various alternate hosts files by combining and adding the gambling, porn, and social media extensions. You need to be connected to the Internet. This file REQUIRED installed Python 3.5.x runtime environment in Windows System. Launch this file as normal user.|
 :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
-|Run `updateHostsWindows.bat` BATCH file will replace hosts file and reload DNS cache in Windows System. You need to be connected to the Internet. This file REQUIRED installed Python 3.5.x runtime environment in Windows System.|
+|`updateHostsWindows.bat` BATCH file will replace hosts file and reload DNS cache in Windows System. You need to be connected to the Internet. This file REQUIRED installed Python 3.5.x runtime environment in Windows System.|
 :---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 
 |If you want using huge hosts file with merged [hphosts](https://www.hosts-file.net) (NOT INCLUDED HERE) you need to DISABLE and STOP `Dnscache` service before you replace hosts file in Windows Systems. You have been warned.|
index 37c4a84cb1ed3c49b20dcdd3f43b9e67fdfe54b4..9dbcfe8752865870c93849805d0b0ddebcbcc9a8 100644 (file)
@@ -1,72 +1,77 @@
-:: This script will create in first running backup of ORIGINAL/CURRENT hosts file in hosts.skel file.
-:: If hosts.skel file exists, then NEW copy with customized unified hosts file will be copied to proper path.
-:: Next DNS Cache will be refreshed.
-:: THIS BAT FILE WILL BE LAUNCHED WITH ADMINISTRATOR PRIVILIGES
-@ECHO OFF
-
-VER | FINDSTR /L "5.1." > NUL
-IF %ERRORLEVEL% EQU 0 GOTO START
-
-VER | FINDSTR /L "5.2." > NUL
-IF %ERRORLEVEL% EQU 0 GOTO START
-
-:UAC_ADMIN
->nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"  
-if '%ERRORLEVEL%' NEQ '0' (
-    ECHO Requesting administrative privileges...
-    GOTO UAC_PROMPT
-) else (
-    GOTO ADMIN
-)
-
-:UAC_PROMPT
-ECHO Set UAC = CreateObject^("Shell.Application"^) > "%TEMP%\getadmin.vbs"
-ECHO UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%TEMP%\getadmin.vbs"
-"%TEMP%\getadmin.vbs"
-EXIT /B
-
-:ADMIN
-if exist "%TEMP%\getadmin.vbs" (
-    DEL "%TEMP%\getadmin.vbs"
-)
-pushd "%CD%"
-CD /D "%~dp0"
-CD %CD%
-%COMSPEC% /c "updateHostsWindows.bat" start
-EXIT
-
-:START
-if not exist "%WINDIR%\py.exe" (
-       ECHO :: ERROR :: Python 3.5 Runtime NOT FOUND...
-       ECHO :: ERROR :: Download and install lastest Python 3.5 for Windows from https://www.python.org/downloads/
-       ECHO :: ERROR :: Exit...
-       GOTO END
-) ELSE ( 
-       GOTO PY35RT
-)
-
-:PY35RT
-if not exist "%LOCALAPPDATA%\Programs\Python\Python35\Python35.dll" (
-       ECHO :: ERROR :: Python 3.5 Runtime NOT FOUND...
-       ECHO :: ERROR :: Download and install lastest Python 3.5 for Windows from https://www.python.org/downloads/
-       ECHO :: ERROR :: Exit...
-       GOTO END
-) ELSE ( 
-       ECHO :: INFO :: Python 3.5 Runtime was found...
-       ECHO :: INFO :: Running main script...
-    GOTO DNSCHECK
-)
-
-:DNSCHECK
-if not exist "%WINDIR%\System32\drivers\etc\hosts.skel" (
-       COPY %WINDIR%\System32\drivers\etc\hosts %WINDIR%\System32\drivers\etc\hosts.skel
-       GOTO :CLEARDNS
-)
-
-:CLEARDNS
-updateHostsFile.py -a
-COPY hosts %WINDIR%\System32\drivers\etc\
-ipconfig /flushdns
-GOTO END
-
-:END
+:: This script will create in first running backup of ORIGINAL/CURRENT hosts file in hosts.skel file.\r
+:: If hosts.skel file exists, then NEW copy with customized unified hosts file will be copied to proper path.\r
+:: Next DNS Cache will be refreshed.\r
+:: THIS BAT FILE WILL BE LAUNCHED WITH ADMINISTRATOR PRIVILIGES\r
+@ECHO OFF\r
+SETLOCAL EnableDelayedExpansion\r
+TITLE Update Hosts\r
+\r
+VER | FINDSTR /L "5.1." > NUL\r
+IF %ERRORLEVEL% EQU 0 GOTO START\r
+\r
+VER | FINDSTR /L "5.2." > NUL\r
+IF %ERRORLEVEL% EQU 0 GOTO START\r
+\r
+CLS\r
+IF "%1"=="" GOTO CHECK_UAC\r
+IF "%1"=="start" GOTO START\r
+\r
+:CHECK_UAC\r
+>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"  \r
+If '%ERRORLEVEL%' NEQ '0' (\r
+    ECHO Requesting administrative privileges...\r
+    GOTO UAC_PROMPT\r
+) Else (\r
+    GOTO ADMIN\r
+)\r
+\r
+:UAC_PROMPT\r
+ECHO Set UAC = CreateObject^("Shell.Application"^) > "%TEMP%\getadmin.vbs"\r
+ECHO UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%TEMP%\getadmin.vbs"\r
+"%TEMP%\getadmin.vbs"\r
+EXIT /B\r
+\r
+:ADMIN\r
+IF EXIST "%TEMP%\getadmin.vbs" ( DEL "%TEMP%\getadmin.vbs" )\r
+PUSHD "%CD%"\r
+CD /D "%~dp0"\r
+CD %CD%\r
+%COMSPEC% /c "updateHostsWindows.bat" start\r
+EXIT\r
+\r
+:START\r
+if not exist "%WINDIR%\py.exe" (\r
+       ECHO :: ERROR :: Python 3.5 Runtime NOT FOUND...\r
+       ECHO :: ERROR :: Download and install lastest Python 3.5 for Windows from https://www.python.org/downloads/\r
+       ECHO :: ERROR :: Exit...\r
+       GOTO END\r
+) ELSE ( \r
+       GOTO PY35RT\r
+)\r
+\r
+:PY35RT\r
+if not exist "%LOCALAPPDATA%\Programs\Python\Python35\Python35.dll" (\r
+       ECHO :: ERROR :: Python 3.5 Runtime NOT FOUND...\r
+       ECHO :: ERROR :: Download and install lastest Python 3.5 for Windows from https://www.python.org/downloads/\r
+       ECHO :: ERROR :: Exit...\r
+       GOTO END\r
+) ELSE ( \r
+       ECHO :: INFO :: Python 3.5 Runtime was found...\r
+       ECHO :: INFO :: Running main script...\r
+    GOTO DNSCHECK\r
+)\r
+\r
+:DNSCHECK\r
+if not exist "%WINDIR%\System32\drivers\etc\hosts.skel" (\r
+       COPY %WINDIR%\System32\drivers\etc\hosts %WINDIR%\System32\drivers\etc\hosts.skel\r
+       GOTO :CLEARDNS\r
+)\r
+\r
+:CLEARDNS\r
+updateHostsFile.py -a\r
+COPY hosts %WINDIR%\System32\drivers\etc\\r
+ipconfig /flushdns\r
+GOTO END\r
+\r
+:END\r
+ENDLOCAL\r
git clone https://git.99rst.org/PROJECT