欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【vbs】每30分钟提醒自己休息眼睛

程序员文章站 2024-01-28 19:59:58
...

1.vbs

if(IsProcess("wscript.exe")) then
createobject("wscript.shell").run "taskkill.exe /IM cscript.exe /F"
wscript.quit
end if
'wscript.sleep 5*1000*60
do
if (msgbox("眼睛需要休息了",vbSystemModal+vbYesNo+vbQuestion))=6 then
wscript.sleep 30*1000*60
else
msgbox "?",vbSystemModal+vbCritical
wscript.sleep 3*1000*60
end if
loop
Function IsProcess(ExeName)
  Dim WMI, Obj, Objs,i
  IsProcess = False
  Set WMI = GetObject("WinMgmts:")
  Set Objs = WMI.InstancesOf("Win32_Process")
  For Each Obj In Objs
    If InStr(UCase(ExeName),UCase(Obj.Description)) <> 0 Then
      IsProcess = True
      Exit For
    End If
  Next
  Set Objs = Nothing
  Set WMI = Nothing
End Function

run.bat

@echo off
cscript 1.vbs

乐,我小学五年级玩的东西我现在高一现在还在玩

分别保存

运行时打开run.bat

运行了多个run.bat时运行1.vbs