Skip to content

Instantly share code, notes, and snippets.

View andreymir's full-sized avatar

Andrei Mironov andreymir

View GitHub Profile
21 12
63 36
291 192
502 250
2518 1258
2817 1872
2991 1992
4435 3544
5229 2952
5367 3576
@andreymir
andreymir / hosts.ps1
Last active October 13, 2018 03:22 — forked from markembling/hosts.ps1
Powershell script for adding/removing/showing entries to the hosts file.
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
$file = join-path -path $env:SystemRoot -childpath "System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
remove-host $filename $hostname
$ip + "`t`t" + $hostname | Out-File -encoding ASCII -append $filename
}