直接上代码

# author:lttr <www.cnblogs.com/GoCircle> 
# 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文件中存在该配置信息。" }

 

 

相关文章:

  • 2021-06-07
  • 2022-01-11
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-01
  • 2021-12-07
  • 2022-02-05
  • 2022-02-14
  • 2022-02-11
  • 2021-09-20
相关资源
相似解决方案