几行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

SogouInput


posted @ 2024-12-04 02:00  潘钜森  阅读(9)  评论(0编辑  收藏  举报