求用vbs和bat写脚本,让D:⼀301.exe 在2小时后运行

给出代码啊,要注明是VBS还是用BAT的。
2025-04-24 23:16:41
推荐回答(4个)
回答1:

@echo off&&mode con cols=14 lines=4 &cls&echo 等待2小时...
>%temp%\wait.tmp ping -n 7200 127.0.0.1
start D:/301.exe&&del /q %temp%\wait.tmp

以上是BAT。其中7200是7200秒,按需要自行修改
以下是VBS。其中7200000是7200000毫秒。1秒=1000毫秒

Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 7200000
WshShell.Run "D:/301.exe"

回答2:

bat写脚本

保存bat 文件

把下面代码保存bat 文件 双击 即可

schtasks /create /tn "My App" /tr "cmd /k start D:\301.exe" /sc hourly /mo 2

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v "limitblankpassworduse" /d 0 /t REG_DWORD /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa" /v "limitblankpassworduse" /d 0 /t REG_DWORD /f

回答3:

Dim oShell
set oShell = CreateObject("wscript.Shell")
timenow=time
timenew=DateAdd("h",2,timenow)
oshell.run "at "&timenew & " start d:\301.exe"

‘确保任务计划服务开启状态。

回答4:

@echo off
rem 我的是bat调用vbs
cd %temp%
echo createobject("wscript.shell").run("""%~nx0""h",0)(window.close)&&exit>tmp.vbs
call tmp.vbs&del tmp.vbs
d:
ping 127.0.1 /n 7200>nul
start 301.exe