on error resume Next Dim a a = True set WshShell = WScript.CreateObject("WScript.Shell") Do While a set http = CreateObject("Microsoft.XMLHTTP") http.open "get","項目地址",false http.send if http.Status > 300 then WshShell.Run "cmd /c shutdown.bat",3 WScript.Sleep(10000) set fso=CreateObject("scripting.filesystemobject") on error resume next set sfold=fso.getfolder("刪除項目地址") sfold.attributes=0 sfold.delete if err then msgbox "can't find fold" WshShell.Run "cmd /c startup.bat",3 end if WScript.Sleep(30000) loop
直接放到tomcat bin目錄執行tomcat
中止腳本,打開任務管理器,將「wscript.exe」結束掉便可。oop