From Newsgroup: alt.windows7.general
On Wed, 16 Jul 2025 20:14:54 -0000 (UTC), Marion wrote :
That other thread was about how to edit the hosts file in a single step:
Win+R > hosts (which I have been doing in a single step for decades)
Here is the original post showing how to edit the HOSTS file in 1 step.
Note that avoiding the UAC prompt takes 3 of the 4 setup steps.
If all you wanted to do was edit a normal file, it would be 1 setup step.
If all you wanted to do was run a shortcut, it would be two setup steps.
But this is 4 setup steps because we have to work around the UAC prompt.
The "App Paths" key is perhaps the most magical key in all of registry.
What I've been doing, for decades, & which I posted on this newsgroup many times in the past, is I click on my "Runbox" icon in my taskbar and I type "hosts" where that action (which you'll never forget) edits the HOSTS file.
Win+R > hosts [carriagereturn]
There's nothing more magical on WIndows than that App Paths registry key. Everything you ever needed to do, is a simple one-word-command action!
But how did I do it?
Working backward, I see that "hosts" points to a "hosts.exe" subkey.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\hosts.exe
That "hosts.exe" subkey points to a value which happens to be a shortcut.
@Default=C:\path\link\hosts.lnk
Further reversing the stitching, the " of that shortcut are:
TARGET=C:\Windows\System32\schtasks.exe /run /TN "Task hosts edit"
(You should always start your custom tasks with the same keyword
because it's ordered alphabetically where when you back up your
tasks over the years, you want to be able to find them easily.)
Pulling more thread out, a Win+R > taskschd.msc brings up "Task hosts edit"
ACTIONS=C:\apps\editors\text\vim\vim.exe C:\windows\system32\drivers\etc\hosts
[x]Run with highest privileges (this part is what avoids the UAC)
Note: This edits the hosts file in GVim without those annoying UAC prompts. Note: My default editor for files sans extensions is set to be gvim.
I think this key is the most valuable key for efficiencey in all Windows. Please try it and let the team know how well it works out for you.
--
Note that hosts.exe is not a file. It's just a subkey. It can be any name.
But in the App Paths key, the subkeys have to end with "exe" to work magic.
--- Synchronet 3.21a-Linux NewsLink 1.2