求教一个VBS问题。

来源:百度知道 编辑:UC知道 时间:2024/06/18 09:38:03
REM LZS
dim a,ctr
ctr=0
const pass="12345"
do
if ctr=3 then
msgbox("已经达到认证上限, 认证程序关闭")
exit do
else
a=inputbox("请输入密码")
if a=pass then
msgbox("认证成功")
set ws=createobject("wscript.shell")
ws.run"D:A.TXT\",3,ture
exit do
else
ctr=ctr+1
msgbox("认证出错, 请检查密码")
set wso=wscript.createobject("Wscript.Shell")
b=Chr(32)
t=inputbox("")
if t="" then
wso.run("shutdown "&b&" -a")
else
t=t*60
end if
wso.run("shutdown "&b&" -s "&b&" -t "&b&" "&t&"")
wscript.quit
end if
end if
loop
想修改下,使得启动该VBS时,自动运行某程序,密码正确后运行另依程序。

set ws=createobject("wscript.shell")
ws.run "c:\windows\system32\notepad.exe",3

'启动vbs自动运行记事本,这里改为你的程序

ctr=0
const pass="12345"

do
if ctr=3 then
msgbox("已经达到认证上限, 认证程序关闭")
exit do
else
a=inputbox("请输入密码")
if a=pass then
msgbox("认证成功")
set ws=createobject("wscript.shell")
ws.run "c:\windows\system32\calc.exe",3

ws.run "taskkill /f /im notepad.exe",hide
'认证成功后,运行计算器,并结束记事本这里该为你想要的程序

exit do

else
ctr=ctr+1
msgbox("认证出错, 请检查密码")
end if
end if
loop