运行脚本的脚本

发布于 2024-09-02 02:56:28 字数 1120 浏览 10 评论 0原文

我在 vbscript 上有一个脚本

Dim WSHShell, WinDir, Value, wshProcEnv, fso, Spath    

Set WSHShell = CreateObject("WScript.Shell")    


Dim objFSO, objFileCopy    
Dim strFilePath, strDestination    

 Const OverwriteExisting = True    
 Set objFSO = CreateObject("Scripting.FileSystemObject")    
 Set windir = objFSO.getspecialfolder(0)    
 objFSO.CopyFile "\\dv.rt.ru\SYSVOL\DV.RT.RU\scripts\shutdown.vbs", windir&"\", OverwriteExisting    

strComputer = "."    
Set objWMIService = GetObject("winmgmts:" _    
    & "{impersonationLevel=impersonate}!\\" _    
    & strComputer & "\root\cimv2")     
JobID = "1"    

Set colScheduledJobs = objWMIService.ExecQuery _    
    ("Select * from Win32_ScheduledJob")    
For Each objJob in colScheduledJobs    
 objJob.Delete    
Next    

Set objNewJob = objWMIService.Get("Win32_ScheduledJob")    
errJobCreate = objNewJob.Create _    
    (windir & "\shutdown.vbs", "********093000.000000+660", _    
        True, 1 OR 2 OR 4 OR 8 OR 16 OR 32 OR 64, ,True, JobId) 

如何使 shutdown.vbs 不在 9:30 运行一次,而是在 9:30 到 12:00 运行

I have a script on vbscript

Dim WSHShell, WinDir, Value, wshProcEnv, fso, Spath    

Set WSHShell = CreateObject("WScript.Shell")    


Dim objFSO, objFileCopy    
Dim strFilePath, strDestination    

 Const OverwriteExisting = True    
 Set objFSO = CreateObject("Scripting.FileSystemObject")    
 Set windir = objFSO.getspecialfolder(0)    
 objFSO.CopyFile "\\dv.rt.ru\SYSVOL\DV.RT.RU\scripts\shutdown.vbs", windir&"\", OverwriteExisting    

strComputer = "."    
Set objWMIService = GetObject("winmgmts:" _    
    & "{impersonationLevel=impersonate}!\\" _    
    & strComputer & "\root\cimv2")     
JobID = "1"    

Set colScheduledJobs = objWMIService.ExecQuery _    
    ("Select * from Win32_ScheduledJob")    
For Each objJob in colScheduledJobs    
 objJob.Delete    
Next    

Set objNewJob = objWMIService.Get("Win32_ScheduledJob")    
errJobCreate = objNewJob.Create _    
    (windir & "\shutdown.vbs", "********093000.000000+660", _    
        True, 1 OR 2 OR 4 OR 8 OR 16 OR 32 OR 64, ,True, JobId) 

How make that shutdown.vbs not run once at 9:30 but run for 9:30 to 12:00

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぇ气 2024-09-09 02:56:28
  • 修改 shutdown.vbs 脚本来检查时间 - 如果在 9:30 到 12:00 之间,则 shutdown
  • 安排两项任务来执行关机脚本:一项在 9:30 运行,一项在系统启动时运行。
  • Modify your shutdown.vbs script to check the time - if it's between 9:30 and 12:00, shutdown
  • Schedule two tasks to execute the shutdown script: one that runs at 9:30 and one that runs on system startup.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文