![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-23 12:21 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » How to use DOS to find an EXE file and then add it to the firewall rules to prohibit internet access |
| Printable Version 2,364 / 1 |
| Floor1 1M1048576 | Posted 2021-03-30 11:20 |
| 新手上路 Posts 4 Credits 10 | |
|
Environment:
Under Windows 10, when a program runs, it randomly generates a folder with a 12-character name in C:\Program Files\ Inside this folder, a 123.exe executable program will be generated This 123.exe is what we need, but it has a serious bug when it connects to the Internet while running So we need to add 123.exe to the firewall rules to prohibit it from connecting to the Internet How to achieve this PS: The randomly generated 12-character name folder is uncontrollable Known firewall command netsh advfirewall firewall add rule name="Rule" dir=in program="C:\Program Files\Randomly generated 12-character name folder\123.exe" action=block [ Last edited by 1M1048576 on 2021-3-30 at 13:16 ] |
|
| Floor2 1M1048576 | Posted 2021-03-30 18:31 |
| 新手上路 Posts 4 Credits 10 | |
|
I have an idea. First, use the dir command to find the 123.exe file. Then write the path of 123.exe to 1.txt. Then call the content in the 1.txt file to assign a value to a variable, and finally write the firewall rule. The commands are as follows:
cd c:\"program files" dir /a -d /s /b 123.exe>1.txt It has been tested that the complete path of 123.exe can be obtained, but I don't know how to do the next step of assignment... |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |