notes/snippet/vbscript/start.vbs

21 lines
523 B
Plaintext

REM 文件编码需要使用 ANSI
Set objsws = GetObject("winmgmts:\\.\root\cimv2")
Set colPro = objsws.ExecQuery("select * from Win32_Process where name = 'wscript.exe'")
check = 0
for each objProcess in colPro
if instr(objProcess.CommandLine, "start.vbs") then
check = check + 1
end if
next
if check > 1 then
msgbox "Doing job..."
else
Set objShell = CreateObject("Wscript.Shell")
msgbox "点击确认开始运行"
do
Wscript.Sleep 150000
objShell.SendKeys "{SCROLLLOCK}"
loop
end if