几行bat代码命令禁止搜狗输入法所有.exe联网
温馨提示:请确保 Windows防火墙
为 开启
状态
@echo off
:: 判断是否以管理员运行,否则重启并以管理员运行
net session >nul 2>&1
if %errorlevel% neq 0 (
PowerShell -Command "Start-Process '%~dpnx0' -Verb RunAs"
exit /b
)
:: 文件夹绝对路径
set fpath="D:\Softwares\SogouInput" >nul
:: 删除所有出入站规则
netsh advfirewall firewall delete rule name="Sogou Pinyin Service" >nul
:: 循环获取.exe并写入规则
for /r "%fpath%" %%p in (*.exe) do (
netsh advfirewall firewall add rule name="Sogou Pinyin Service" dir=in action=block profile=any program=%%p enable=yes >nul
netsh advfirewall firewall add rule name="Sogou Pinyin Service" dir=out action=block profile=any program=%%p enable=yes >nul
)
echo Done.
pause
本文来自博客园,作者:潘钜森,转载请注明原文链接:https://www.cnblogs.com/geoi6sam1/p/18585253/SogouInput