> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/rdm/knowledge-base/how-to-articles/edit-hosts-file.md).

# Edit hosts file

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 this goal, but experience tells us that most people do not bother with it, ending up losing precious time when they must modify the hosts file.

What better tool than 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 for all of them.

Simply create a session with the proper settings.

### Steps

1. Create a new ***Command Line (External Application)*** session and enter a session name. In the ***General*** tab,click on the ellipsis button and select your editor of choice in the Run text box. Then, paste the following after the name of the program: "**C:\Windows\System32\drivers\etc\hosts**". Ensure a blank space separates the two and includes the double quotes.

   <figure><img src="https://cdnweb.devolutions.net/docs/docs_en_kb_KB4548.png" alt=""><figcaption></figcaption></figure>
2. In the ***Advanced*** tab, check the ***Run as Administrator*** option.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Close your editor before proceeding with those steps. If your editor is already running, it will not elevate the privileges. We have implemented an AutoHotKey script that closes the editor of choice, but being that it shuts off without saving pending changes, it is not a risk-free solution. It will all depend on your chosen editor's reaction to the WM_QUIT message.</p></div>

   <figure><img src="https://cdnweb.devolutions.net/docs/docs_en_kb_KB4549.png" alt=""><figcaption></figcaption></figure>

It is a simple and efficient solution. You can use this for any tool you use regularly. Paired with a Team workspace it makes for a powerful library of tools for your team.

### Alternative if you want to use the Parameters tab

Some people wish 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.

1. Create a new Command Line session and in the ***Advanced*** tab, check the ***Run as Administrator*** and disable the ***Use Shell Execute*** option.

   <figure><img src="https://cdnweb.devolutions.net/docs/docs_en_kb_KB4550.png" alt=""><figcaption></figcaption></figure>
2. In the ***General*** tab,click on the ellipsis button and select your editor of choice in the ***Run*** text box. Then enter "{1}" after the name of the executable, keeping a space between the two values and including the quotes.

   <figure><img src="https://cdnweb.devolutions.net/docs/docs_en_kb_KB4551.png" alt=""><figcaption></figcaption></figure>
3. In the ***Parameters*** tab, set Parameter # 1 type to ***Text*** and then enter the following in the Default Value: **C:\Windows\System32\drivers\etc\hosts**. This is helpful when mostly using the tool with a certain file, but occasionally need to edit another file. You could have separate entry for each file you commonly edit, but this shows how flexible Remote Desktop Manager can be.

   <figure><img src="https://cdnweb.devolutions.net/docs/docs_en_kb_KB4552.png" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devolutions.net/rdm/knowledge-base/how-to-articles/edit-hosts-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
