Edit Hosts File: Tips&Tricks

Max Trottier Tips & Tricks Leave a comment

image_pdfimage_print

Hi everyone!

IT technicians, as well as web developers, often need to edit the Windows hosts file. This requires starting your favorite editor using elevated privileges (obviously only if UAC is active), browsing for the hosts file which is deep in the windows folder and enclosed in a hidden folder on top of that.
For your own machine you can create a shortcut to achieve your goal, but our experience tells us that most people don’t bother with it, ending up losing precious minutes every time they must modify the hosts file.
What better tool then one that you use every day, which is already running in the notification area, to implement a solution with. If the machines you work on have the same setup, this will work on all of them.
Simply create a session with the proper settings.
 
Steps
1. Create a new Command Line session.
2. Enter a session name
3. Check the Run as Administrator check box.
4. Using the ellipsis button, select your editor of choice in the Run text box.
5. Paste the following after the name of the program, ensure a blank space separates the two and include the double quotes. “c:WindowsSystem32driversetchosts”
If your editor is already running, it will not elevate the privileges. You should close it
beforehand. I’ve implemented a AutoHotKey script that closes my editor of choice, but
being that it shuts off without saving pending changes, its not a solution for the faint
hearted. It depends on your chosen editor’s reaction to the WM_QUIT message
 
That’s it. Simple and efficient. You can use this for any tool you use regularly. Paired with shared data source it makes for a powerful library of tools for your team.
Alternative if you want to use the Parameters tab
Some people want to use the parameters tab because, upon launching, it will display a dialog where you can confirm the value of the parameters and even allows you to change them for whole new values.
Steps 1 to 4 are the same
Step 5 – Enter “{1}” after the name of the executable, keeping a space between the two values andincluding the quotes.
Step 6 – Uncheck “Use Shell Execute”
Step 7 – In the parameters tab, set parameter # 1 type to “Text”
Step 8 – Enter the following in the Default Value : c:WindowsSystem32driversetchosts
 
.
This is helpful if you mostly use the tool with a certain file, but occasionally need to edit another file. I’d rather have a separate entry for each file I commonly edit, but this shows how flexible Remote Desktop Manager really is.
About the Author

Max Trottier

Twitter

Maxime has extensive experience in product management, communication and advertising, and has spent the last several years helping renowned organizations bring their high-end solutions to customers worldwide. As Director of Marketing, Maxime leads Devolutions’ international market research and development efforts, along with customer relations and overall business development. He’s driven to bring innovative and cutting-edge solutions to Devolutions’ customers around the globe. Maxime earned his Bachelor degree in Business Administration from the University of Québec at Trois-Rivières, and regularly attends sales and marketing workshops to increase his knowledge and expertise.

Max TrottierEdit Hosts File: Tips&Tricks
  • http://www.grans.eu/ Alexander Gran

    Editing host files tends to indicate a significant issue with the IT strategy.
    But I like the general idea!

  • Anonymous

    Not always. In a DMZ environment where you do not want to publish your internal DNS zones editing the hosts file is the best answer.

  • http://www.blogger.com/profile/02428203912151861198 dodge

    Works well, nice idea :)