MVPS Hosts File Install Routine

Post tutorials and script examples in this forum.
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Post Reply
zbmowrey
Posts: 38
Joined: Sun Apr 06, 2014 6:55 pm

MVPS Hosts File Install Routine

Post by zbmowrey » Tue Sep 02, 2014 5:51 am

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).

Fred
Site Admin
Posts: 2221
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: MVPS Hosts File Install Routine

Post by Fred » Tue Sep 02, 2014 10:49 am

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 167 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 155 times
Keep in mind your app will not work if the hosts file is immunized by UVK.
What is the hardest thing to develop? A good application? A good website? Nope. A good reputation.

Fred

zbmowrey
Posts: 38
Joined: Sun Apr 06, 2014 6:55 pm

Re: MVPS Hosts File Install Routine

Post by zbmowrey » Wed Sep 03, 2014 7:20 am

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.

Fred
Site Admin
Posts: 2221
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: MVPS Hosts File Install Routine

Post by Fred » Wed Sep 03, 2014 7:45 am

%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.
What is the hardest thing to develop? A good application? A good website? Nope. A good reputation.

Fred

Thomask
Posts: 7
Joined: Thu Jul 27, 2017 4:59 am

Re: MVPS Hosts File Install Routine

Post by Thomask » Thu Jul 27, 2017 5:02 am

This is an old post what is the best current solution to do this . Or has it been added to the immunizes

Fred
Site Admin
Posts: 2221
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: MVPS Hosts File Install Routine

Post by Fred » Thu Jul 27, 2017 5:55 pm

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.
What is the hardest thing to develop? A good application? A good website? Nope. A good reputation.

Fred

Thomask
Posts: 7
Joined: Thu Jul 27, 2017 4:59 am

Re: MVPS Hosts File Install Routine

Post by Thomask » Fri Aug 18, 2017 7:12 pm

thanks

Post Reply