.bat文件)实现延时启动指定软件,以下是几种不同的方法,您可以根据需求选择最适合的方式。方法 1:使用 timeout命令(推荐)
timeout命令)。步骤:
-
新建一个 .bat文件(例如delay_start.bat)。 -
编辑内容: @echo off timeout /t 60 /nobreak >nul start "" "C:\Program Files\Google\Chrome\Application\chrome.exe"-
timeout /t 60:等待 60 秒(可调整)。 -
/nobreak:防止用户按键跳过等待。 -
>nul:隐藏倒计时显示。 -
start "" "...":启动目标程序(替换为您的软件路径)。
-
-
保存并放入启动文件夹: -
按 Win + R,输入shell:startup,回车。 -
将 .bat文件复制到此文件夹,电脑启动后会自动执行。
注意:我在 Win10 中使用了该方法。
-
方法 2:使用 ping命令(兼容性更好)
timeout命令时)。步骤:
-
新建 .bat文件(例如delay_start_ping.bat)。 -
编辑内容: @echo off ping 127.0.0.1 -n 60 >nul start "" "C:\Program Files\Google\Chrome\Application\chrome.exe"-
ping 127.0.0.1 -n 60:通过 ping 本地地址 60 次(约 60 秒)。 -
>nul:隐藏 ping 的输出。
-
-
放入启动文件夹(同方法 1)。
方法 3:使用 choice命令(Win10+ 推荐)
choice更精确)。步骤:
-
新建 .bat文件(例如delay_start_choice.bat)。 -
编辑内容: @echo off choice /C y /N /D y /T 60 >nul start "" "C:\Program Files\Google\Chrome\Application\chrome.exe"-
/T 60:等待 60 秒。 -
/D y:默认选择 "y"(避免卡住)。 -
>nul:隐藏提示。
-
-
放入启动文件夹(同方法 1)。
方法 4:使用 VBScript 隐藏黑窗口
步骤:
-
新建 delay_start.vbs:Set WshShell = CreateObject("WScript.Shell") WshShell.Run "cmd /c C:\path\to\your\delay_start.bat", 0, False-
0:隐藏窗口。 -
替换 C:\path\to\your\delay_start.bat为您的.bat文件路径。
-
-
将 .vbs文件放入启动文件夹(shell:startup)。
总结
|
|
|
|
|
|---|---|---|---|
timeout |
|
|
|
ping |
|
|
|
choice |
|
|
|
|
|
|
|
.vbs文件 |
-
Win10/11 用户 → 方法 3( choice) 或 方法 1(timeout)。 -
Win7/XP 用户 → 方法 2( ping)。 -
不想看到黑窗口 → 方法 4(VBScript)。


