延时 启动exe程序

restart_SmartPLCDataCollect.bat

@echo off

::强制获取管理员运行权限
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
::杀进程
taskkill /f /im iSmartPLCDataCollect.exe

::timeout 15

::dir
::cd D:\项目\湖州-蜂巢-赢合\一楼C11\2023-10-16\Debug

::timeout 10


::路径里有中文启动失败
::start D:\项目\湖州-蜂巢-赢合\一楼C11\2023-10-16\Debug\iSmartPLCDataCollect.exe
::路径里无中文启动成功
start D:\software\Debug\iSmartPLCDataCollect.exe

放到开机启动文件夹:

C:\Users\hlg\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

power_on_startup_SmartPLCDataCollect.vbs

WScript.Sleep 20000
CreateObject("WScript.Shell").Run"D:\software\restart_SmartPLCDataCollect.bat",0

你可能感兴趣的:(服务器,linux,前端)