一个 Windows 命令行工具,用于自动重新连接到指定的 WiFi 网络。可指定WiFi名(暂只支持一个WiFi)、重连时长、适配器、日志。
A Windows command line tool for automatically reconnecting to a specified WiFi network. You can specify the WiFi name (currently only supports one WiFi), reconnection time, adapter, and log.
- Windows 操作系统。
- Go 1.21 或更高版本 (如果您需要从源码编译)。
- 克隆仓库 (或下载源代码):
git clone [https://github.com/htnosakura/go-reconnectwifi.git](https://github.com/htnosakura/go-reconnectwifi.git) cd go-reconnectwifi
- 编译可执行文件:
go build -o go-reconnectwifi.exe
通过命令提示符 (CMD) 或 PowerShell 使用以下参数运行程序:
-ssid <字符串>
: (必需) 要连接的 WiFi 网络的 SSID (名称)。如果 SSID 包含空格,请用引号括起来 (例如:"我的 WiFi"
)。-interface <字符串>
: (可选) 您的无线网络接口的名称 (例如:"WLAN", "Wi-Fi")。如果省略,程序将尝试自动检测。-interval <时长>
: (可选) 状态检查的时间间隔 (例如:10s
,1m
,30s
)。默认:15s
。-logfile <字符串>
: (可选) 日志文件的路径。如果省略,日志将输出到控制台。例如:wifi.log
或C:\logs\wifi.log
。-loglevel <字符串>
: (可选) 日志级别:debug
,info
,warn
,error
。默认:info
。
示例:
.\go-reconnectwifi.exe -ssid "你的WiFi名称" -interface "WLAN" -interval 30s -logfile "reconnect.log" -loglevel debug
本程序采用 GNU通用公共许可证v3.0 授权。更多详情请参阅 LICENSE 文件。
- Windows Operating System.
- Go 1.21 or newer (for building from source).
- Clone the repository (or download the source code):
git clone [https://github.com/htnosakura/go-reconnectwifi.git](https://github.com/htnosakura/go-reconnectwifi.git) cd go-reconnectwifi
- Build the executable:
go build -o go-reconnectwifi.exe
Run the program from a Command Prompt (CMD) or PowerShell using the following parameters:
-ssid <string>
: (Required) The SSID (name) of the WiFi network. Enclose in quotes if it contains spaces (e.g.,"My WiFi"
).-interface <string>
: (Optional) Name of your wireless network interface (e.g., "WLAN", "Wi-Fi"). If omitted, attempts auto-detection.-interval <duration>
: (Optional) Time interval for status checks (e.g.,10s
,1m
,30s
). Default:15s
.-logfile <string>
: (Optional) Path to a log file. If omitted, logs go to the console. Example:wifi.log
orC:\logs\wifi.log
.-loglevel <string>
: (Optional) Logging level:debug
,info
,warn
,error
. Default:info
.
Example:
.\go-reconnectwifi.exe -ssid "YourWiFiSSID" -interface "WLAN" -interval 30s -logfile "reconnect.log" -loglevel debug
This program is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.