Privacy Power! home  |  what's new  |  site map  |  kudos  |  links  |  legal  |  about
Advertising & Marketing  |  Adware, Badware & Spyware  |  Help & How To's


Privacy Power!  Home:  Help & How To's:  Hosts File: "Temporarily Suspend" Tricks

Milly's Suspend Hosts Batch File | Mike's Suspend Hosts From Netscape Toolbar
 

Milly's HostSusp.bat - Temporarily Suspend Hosts File  

"I use a batch file (culled from a more extensive hosts batch file utility produced by Bruce. Save what's between the lines as HostSusp.bat and put a shortcut to it somewhere convenient."

How-To: Copy and paste everything between the first and last dotted lines (don't include the dotted lines) into Windows notepad or whatever notepad replacement you use. Then save the file "...as HostSusp.bat and put a shortcut to it somewhere convenient." Temporarily suspend the hosts file by clicking on the shortcut.

           ----------------------- begin -----------------------

           @echo off
           c:
           cd \windows
           cls
           if not exist hosts echo Sorry, HOSTS file not found by utility!
           if exist hosts copy hosts hosts.ugh
           if exist hosts.dis del hosts.dis
           ren hosts hosts.dis
           echo.
           echo ===============================
           echo backup called hosts.ugh created
           echo               -
           echo    HOSTS has been disabled!
           echo ===============================
           echo.
           echo   Continuing will Re-enable :-
           echo.
           pause
           ren hosts.dis hosts
           cls
           echo.
           :end
           echo.

           ------------------------ end ------------------------

^ Top


Mike C.'s Suspend Hosts From Netscape 4x Personal Toolbar  

"This method can be used to provide personal toolbar shortcuts to any executable file. Credit for the above goes to Bruce (of this NG) for his batch file method to enable/disable hosts." Thanks also go to Peta for corrections to batch file syntax. This tip requires Netscape version 4x.

For further info on creating personal toolbar executable shortcuts visit: idt.net/~khecht19/netscape/exes_on_toolbar.html.

You can create Buttons on the Netscape Personal Toolbar that you can click to enable or disable the Hosts file. (These buttons will be on the PERSONAL TOOLBAR -- the one that has (or had) AOL Instant Messenger on it -- not the Main toolbar). It's neither difficult nor complicated to do, but there are a lot of little steps.

It involves:

1. Creating two batch files (to rename the Hosts file)

2. Creating (in Netscape) two new file types and defining their default actions

3. Creating file associations between the batch files and the two new file types

4. Creating two small 'dummy' files - one for each of the new file types, and...

5. Creating Netscape Personal Toolbar shortcuts to these 'dummy ' files.

At the heart of this method are the two new file types. You will define the default actions of these file types so that whenever these files are referenced their respective batch files will run. These batch files will enable or disable the hosts file by renaming it -- the same method used in the hosts-related batch files authored by Bruce (and subsequently modified by others).

Note: The instructions given below assume your main Windows directory is 'C:\Windows.' If it is something different, make changes as needed. Copy and paste everything between the first and last dotted lines (don't include the dotted lines).

Here are the steps involved:

1. Create two batch files in Notepad. Watch out for word wrap when you copy these files. Each should contain ONLY 2 lines -- the first line begins with '@' and the second begins with 'if':

   a) Name this first batch file hosts_off.bat and place it in your Windows directory:

     ---------- start of 1st batch file ----------

     @echo off
     if exist c:\windows\hosts. ren c:\windows\hosts. hosts.dis >nul

     ---------- end of 1st batch file ----------

   b) Name this 2nd batch file hosts_on.bat and place it in your Windows directory:

     ---------- start of 2nd batch file ----------

     @echo off
     if exist c:\windows\hosts.dis ren c:\windows\hosts.dis hosts. >nul

     ---------- end of 2nd batch file ----------

  c) Now open Windows Explorer. Go to your Windows directory and find the batch files you have just saved. Right click on each of them and select 'Properties.' On the 'Program' tab put a check in the 'close on exit' box and select 'Minimized' from the 'Run' drop-down list. Do this for BOTH batch files.

2. Now, in Netscape, you will create TWO NEW FILE TYPES and define their actions. The new file types must have unique file extensions. They can't be file extensions already in use and they shouldn't be file extensions that might (in the future) be claimed by another application. I've suggested '.dis' file extensions in my instructions below. You don't have to use mine if you don't want to -- just be sure that whatever you choose is and will likely remain unique:

   a) From Navigator choose Edit | Preferences | Navigator | Applications. Click 'New Type' then:

   b) - Under 'Description of Type' enter: Hosts File - Off

       - Under 'File Extension' enter: hstof

       - Under 'MIME Type' enter: application/x-hstof

       - Under 'Application to use' enter the name of the first batch file:
         c:\windows\hosts_off.bat

       - Click 'OK' to approve the changes

       - Then, with the new file type highlighted, click 'Edit' and remove the check from
         'Ask me before opening downloaded files of this type'

   c) Repeat step 2a to create your second new file type, then:

   d) - Under 'Description of Type' enter: Hosts File - On

       - Under 'File Extension' enter: hston

       - Under 'MIME Type' enter: application/x-hston

       - Under 'Application to use' enter the name of the second batch file:
         c:\windows\hosts_on.bat

       - Click 'OK' to approve the changes

       - Then, with the new file type highlighted, click 'Edit' and remove the check from
          'Ask me before opening downloaded files of this type'

3. Now create two new files in Notepad and save them with your new filetype extensions. Place a single line of text in each of the files -- the text is unimportant -- you just don't want them saved as 0 byte files. My files have 'Hello World!!' for their contents. You can insert anything you wish in yours. Save both files to your Windows directory. Save the first as hosts_off.hstof and the second as hosts_on.hston.

4. Now create two Netscape shortcuts to the two new files (the '.hstof' and '.hston' files). In Netscape select Bookmarks | Edit Bookmarks. Rightclick on 'Personal Toolbar Folder' and select 'New Bookmark.'

   a) For the first bookmark 'Name' enter: 'Disable Hosts'
       For 'Location (URL)' enter: file:///C|/Windows/hosts_off.hstof

   b) For the 2nd bookmark 'Name' enter: Enable Hosts
       For 'Location (URL)' enter: file:///C|/Windows/hosts_on.hston

Finished.

Now you can Enable/Disable Hosts with just a click on the Personal Toolbar. You will probably see a brief scrollbar appear as the '.hston' or '.hstof' file is 'downloaded' but the batch files should run in the background (a DOS window may open and close briefly).


Updated: Aug 02-00

^ Top


With WebWasher activated, many links on these pages will not display. Please see About page for fix.

This site uses no cookies or other tracking methods, no scripts and no active content. It looks better in IE than in Netscape.
Please send comments, corrections, suggestions, & new info to privacypwr@yahoo.com.