PowerShellを使用してhostsを修正
1571 ワード
ダイレクトコード
転載先:https://www.cnblogs.com/GoCircle/p/11226620.html
# author:lttr
# date:2019-08-09
[CmdletBinding()]
param
(
[Parameter(Mandatory =$true,Position=0)][string]$IPURL
)
if((Get-Content $env:windir\System32\drivers\etc\hosts |?{$_ -match "/s$IPURL"}) -eq $null){
"`n$IPURL" | Out-File -FilePath "$env:windir\System32\drivers\etc\hosts" -Append -encoding ascii
Write-Host " !"
}else{
Write-Host "host 。"
}
転載先:https://www.cnblogs.com/GoCircle/p/11226620.html