【发布时间】:2016-11-01 00:52:38
【问题描述】:
想要确保此代码会从 hosts 文件中删除特定网站,解除对它的阻止。
pushd %SystemRoot%\system32\drivers\etc\hosts
copy hosts hosts.bak
findstr /v /c:"drive.google.com" hosts.bak > hosts
popd
如果不是,那么我可以在批处理文件中使用什么来从主机文件中删除特定网站。
【问题讨论】:
-
...当你尝试它时发生了什么?
-
findstr /v /c:"drive.google.com" %SystemRoot%\system32\drivers\etc\hosts > %SystemRoot%\system32\d rivers\etc\hosts就是您所需要的。 4 行合为一行。 -
我还没有尝试过,因为我对此还是很陌生,不想只使用我不确定的命令。但是谢谢我会尝试的:)
标签: batch-file hosts-file