Powershell to manipulate host file

All of these answers are pretty elaborate. This is all you need to add a hosts file entry:

Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`n127.0.0.1`tlocalhost" -Force

IP address and hostname are separated by `t which is the PowerShell notation for a tab character.

`n is the PowerShell notation for a newline.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)