Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a shortcut link on my desktop that is a link to the hosts file in Windows 7. The problem is that this shortcut will not open in administrator mode as the option will be greyed out in the shortcut properties/advanced properties.

Is there someway I can create a shortcut link that opens the hosts file in administrator mode?

share|improve this question
up vote 3 down vote accepted
  1. Create a new shortcut on your desktop, and make notepad.exe the target. Give it the name Edit hosts file or something else you prefer and ok to create
  2. Go to the properties of the shortcut, then the short cut tab and change the Target field to be

    C:\Windows\System32\notepad.exe C:\Windows\System32\drivers\etc\hosts

  3. Click Advanced on the same tab, and choose Run as administrator

share|improve this answer

Similar alternative answer to "spoike" but in batch form - use notepad to create the folowing file host.bat then create shortcut to the file.

@Echo off
:: Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
Echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
Echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
Echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
Exit /B
if exist "%temp%\getadmin.vbs" ( Del "%temp%\getadmin.vbs" )
Pushd "%CD%"
CD /D "%~dp0"
C:\Windows\System32\notepad.exe C:\Windows\System32\drivers\etc\hosts
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.