mirror of
https://github.com/bin456789/reinstall.git
synced 2025-12-10 07:28:56 +08:00
core: 添加 frpc 内网穿透
This commit is contained in:
18
windows-frpc-workaround.bat
Normal file
18
windows-frpc-workaround.bat
Normal file
@ -0,0 +1,18 @@
|
||||
@echo off
|
||||
mode con cp select=437 >nul
|
||||
|
||||
rem 如果找到 LOCAL SERVICE 运行的 frpc,则结束 SYSTEM 运行的 frpc
|
||||
rem 如果没找到 frpc,则运行 frpc(本脚本是用 SYSTEM 运行,好像无法 runas "NT AUTHORITY\LOCAL SERVICE")
|
||||
|
||||
rem tasklist 返回值始终为 0,因此需要用 findstr
|
||||
|
||||
:loop
|
||||
tasklist /FI "IMAGENAME eq frpc.exe" /FI "USERNAME eq NT AUTHORITY\LOCAL SERVICE" | findstr /I "frpc.exe" && goto :kill_system_frpc
|
||||
tasklist /FI "IMAGENAME eq frpc.exe" | findstr /I "frpc.exe" || start %SystemDrive%\frpc\frpc.exe -c %SystemDrive%\frpc\frpc.toml
|
||||
timeout 5
|
||||
goto :loop
|
||||
|
||||
:kill_system_frpc
|
||||
taskkill /F /T /FI "IMAGENAME eq frpc.exe" /FI "USERNAME eq NT AUTHORITY\SYSTEM"
|
||||
|
||||
del "%~f0"
|
||||
Reference in New Issue
Block a user