Hosts.ps1 is a PowerShell script for searching, adding, removing, and viewing the windows hosts file from the terminal.
Usage: hosts add
hosts remove
hosts show
hosts search
hosts open
- Open the "terminal" in administrator mode.
- Copy and the paste the code under:
Invoke-Command -ScriptBlock ([Scriptblock]::Create((Invoke-WebRequest -Uri 'https://gist.githubusercontent.com/KristofferRisa/e2316514b3bf8b92a461/raw/14f425eda1b906c2ef16289d639218304bb695ce/install-host.ps1' -UseBasicParsing).Content))
- Done!
The script installs the "hosts.ps1" in the c:\tools\ folder (creates the tools folder if it doesn't exist). Then it adds the "c:\tools" folder into your PATH Environment variables so that you now can type "hosts" anywhere in your terminal
MIT
Broken. To start with, there is no such thing as
print-hosts $file
, replace it withgc $file
.