每天限制a.vbs 的运行次数?
如果a.vbs 运行次数超过2,则退出。
[ Last edited by ooaf on 2009-2-23 at 13:16 ]
如果a.vbs 运行次数超过2,则退出。
[ Last edited by ooaf on 2009-2-23 at 13:16 ]
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
Set WshShell=WScript.CreateObject("WScript.Shell")
Key="HKEY_CURRENT_CONFIG\Software\avbs\"
on error resume next
Last=WshShell.RegRead(Key&"Start")
a=split(Last,"\"):LastDay=a(0)
if LastDay=CStr(date()) then
b=a(1):c=a(2)
if c<>"" then
WshShell.Popup "今天内你已经运行了两次,再见! ",5,"警告!",VbExclamation
Wscript.Quit
end if
else
WshShell.RegDelete(Key&"Start")
end if
on error goto 0
if c="" then WshShell.Regwrite(Key&"Start"),date()&"\1\2"
if b="" then WshShell.Regwrite(Key&"Start"),date()&"\1"
Set WshShell=WScript.CreateObject("WScript.Shell")
num=2 '设置允许启动次数
Key="HKEY_CURRENT_CONFIG\Software\avbs\"
on error resume next
Last=WshShell.RegRead(Key&"Start")
a=split(Last,"\"):LastDay=a(0)
if LastDay=CStr(date()) then
b=cint(a(1)):if b=num then:Wscript.Quit
else
WshShell.RegDelete(Key&"Start")
end if
on error goto 0
ctr=b+1
WshShell.Regwrite(Key&"Start"),date()&"\"&ctr
| 评分人 | 分数 | 时间 |
|---|---|---|
| ooaf | +4 | 2009-02-27 01:31 |
Set WshShell=WScript.CreateObject("WScript.Shell")
Key="HKEY_CURRENT_CONFIG\Software\avbs\"
on error resume next
Last=WshShell.RegRead(Key&"Start")
a=split(Last,"\"):LastDay=a(0)
if LastDay=CStr(date()) then
b=a(1):c=a(2)
if c<>"" then
a=a
Wscript.Quit
end if
else
WshShell.RegDelete(Key&"Start")
end if
on error goto 0
if c="" then WshShell.Regwrite(Key&"Start"),date()&"\1\2"
if b="" then WshShell.Regwrite(Key&"Start"),date()&"\1"