2010-05-18 176 views
1

我有一個的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

+0

請找到代碼格式,或點擊問號尋求幫助。 – Gabriel 2010-05-18 06:32:01

+1

這裏交叉發佈:[ServerFault](http://serverfault.com/questions/142869/script-for-run-script-on-vbs),[ServerFault(關閉)](http://serverfault.com/questions/ 141357/script-for-run-script-closed)和[SuperUser](http://superuser.com/questions/142355/script-for-run-script-on-vbs)。 – 2010-05-18 09:02:24

+0

我不明白你的問題:「如何讓shutdown.vbs在9:30運行一次,但運行時間爲9:30到12:00。」你能否詳細說明一下?渣子 – user235218 2011-06-04 22:44:02

回答

0
  • 修改您的shutdown.vbs腳本檢查時間 - 如果時間在9:30到12:00之間,請關機
  • 計劃執行關機腳本的兩個任務:一個在9:30運行,另一個在系統啓動時運行。