Last Updated: February 25, 2016
·
515
· juanpabloprado

Add a variable in powershell for hosts file

Create a profile by following this guide: http://www.howtogeek.com/50236/customizing-your-powershell-profile/

Add this line to your Microsoft.PowerShell_profile.ps1 file:

$hosts = "%windir%\system32\drivers\etc\hosts"

Now you can
notepad $hosts or atom $hosts from a powershell running as Administrator

If your profile is not loading just type the following command Set-ExecutionPolicy Unrestricted
(https://support.microsoft.com/en-us/kb/2411920)