本帖最后由 ydg881203 于 2022-11-22 20:36 编辑
【已解决】经过 77七 老哥的帮忙,已经可以用了,代码已更新。
我在用这个批处理将目录下的EXE文件禁止联网时,因set "sd=C:\Program Files\Autodesk\AutoCAD 2023\"目录有空格,导致无法执行,烦请大神们帮忙修改一下,感谢。- %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
- @echo off
- set "sd=C:\Program Files\Autodesk\AutoCAD 2023\"
-
- cd/d "%sd%"
- for /r %%a in (*.exe) do (
- netsh advfirewall firewall del rule name="阻止%%~nxa出站">nul 2>nul
- netsh advfirewall firewall add rule name="阻止%%~nxa出站" program="%%a" action=block dir=out>nul
- echo;阻止"%%~nxa"出站
- )
- pause
复制代码
|