Podemos realizar isso editando o Registro e usando o AutoHotkey . Eu chamei meu script OpenAsLocalhost.ahk e usei nomes semelhantes para o meu exemplo.
- Compile o seguinte script do AutoHotkey:
file = %1% server = E:\Server\htdocs\ StringReplace, url, file, %server%, http://localhost/ StringReplace, url, url, \, /, All Run, %url% ExitApp
- Abra o Editor do Registro (
regedit.exe). - Navegue até
HKEY_CLASSES_ROOT\*\shell - Crie uma nova chave em
shell\chamadoOpenAsLocalhost. - Defina o valor
(Default)paraOpen as localhost. - Crie uma nova chave em
OpenAsLocalhost\chamadocommand - Defina o valor
(Default)para"C:\OpenAsLocalhost.exe" "%1" - Feito!