Page 1 of 1

MVPS Hosts File Install Routine

Posted: Tue Sep 02, 2014 5:51 am
by zbmowrey
Applies to 6.6.2.3 (requires UNZIP feature)

Create a new 3rd Party Application and name/describe it.
The file URL is http://winhelp2002.mvps.org/hosts.zip (direct download)
Save it on the current user's desktop (%userprofile%\desktop\hosts.zip).

DO NOT USE %ThirdParty% or other UVK-specific variables. That breaks the rest of the process.

Check the box for automatic unzipping.

On the second page of app setup, use the following 3 commands, in order:

Code: Select all

cmd.exe /c copy %userprofile%\desktop\hosts\hosts %systemroot%\system32\drivers\etc\hosts
cmd.exe /c del %userprofile%\desktop\hosts.zip
cmd.exe /c rd /s /q %userprofile%\desktop\hosts 
This will download the zip to the current user's desktop, then extract to a folder called "hosts". It then copies the hosts file to the proper location in Windows, and finally does some housekeeping by deleting the downloaded .zip and the extracted folder.

What is MVPS Hosts?

It's a 500KB Hosts file designed to filter out and block a great number of malware and adware related domains. It's not perfect, but in a world full of threats, it's not a bad idea to block the known bad guys by default. On a modern PC, I don't even notice the tiny amount of time it takes for my system to check the list before resolving a new domain (cached domains don't consult the list).

Re: MVPS Hosts File Install Routine

Posted: Tue Sep 02, 2014 10:49 am
by Fred
DO NOT USE %ThirdParty% or other UVK-specific variables. That breaks the rest of the process.
Humm... This got me thinking: Why would it not work?

Have you tried to enclose the command's parameters with double quotes?
Download file:%ThirdParty%\hosts.zip

Command:
%ComSpec% /c copy "%ThirdParty%\hosts\hosts" %SystemDir%\drivers\etc\hosts

The zip file and the extraction folder are deleted when UVK is uninstalled.
MVPS Hosts2.uvksr
(2.54 KiB) Downloaded 640 times
Or you can make it even simpler:
Download file: %SystemDir%\drivers\etc.zip

Just check the unzip check box, and you do not need any commands. Well, it will leave some files wandering around, so you can add a command to delete the zip file:

%ComSpec% /c del /f /q %SystemDir%\drivers\etc.zip
MVPS Hosts.uvksr
(2.52 KiB) Downloaded 638 times
Keep in mind your app will not work if the hosts file is immunized by UVK.

Re: MVPS Hosts File Install Routine

Posted: Wed Sep 03, 2014 7:20 am
by zbmowrey
I didn't play with ComSpec... instead I was calling cmd.exe.

CMD.exe doesn't know about %ThirdParty%... or rather, it didn't when I tried it.

I *love* the elegance of your second solution, just unzipping straight to /etc. Saves several steps.

Re: MVPS Hosts File Install Routine

Posted: Wed Sep 03, 2014 7:45 am
by Fred
%ComSpec% expands to C:\Windows\System32\cmd.exe, so it doesn't make any difference. I just like to use %Comspec% because some viruses create a new cmd.exe in the Windows directory which is ran instead of the real cmd.exe.

Your problem was that you weren't enclosing the %ThirdParty%... parameter in double quotes. And since %ThirdParty% expands to C:\Program Files\UVK - Ultra Virus Killer\Third party, which contains several white spaces, the command failed.

You just needed to enclose it in double quotes, and it would be fine.

cmd.exe does know what %ThirdParty% is, and all UVK related variables, if launched by UVK, because it inherits the UVK's environment. Try launching the command prompt from the UVK's IT/Geek tools and tweaks section and enter these commands:
echo %ThirdParty%
echo %SystemDir%

You will see the variables expand correctly.

Re: MVPS Hosts File Install Routine

Posted: Thu Jul 27, 2017 5:02 am
by Thomask
This is an old post what is the best current solution to do this . Or has it been added to the immunizes

Re: MVPS Hosts File Install Routine

Posted: Thu Jul 27, 2017 5:55 pm
by Fred
Thomask, MVPS can be easily added to a UVKSR file as explained above.

App name: MVPS hosts file
Download 1 URL:http://winhelp2002.mvps.org/hosts.zip
Download 1 file:%ThirdParty%\hosts.zip
Option checked: If the downloaded file is a zip file, extract it to a same named folder
Command 1:%ComSpec% /c copy "%ThirdParty%\hosts\hosts" %SystemDir%\drivers\etc\hosts

Or just download one of the UVKSR files linked above and merge to your default UVKSR file.

Re: MVPS Hosts File Install Routine

Posted: Fri Aug 18, 2017 7:12 pm
by Thomask
thanks