- ·上一篇文章:administrator.vbs病毒及清除方法
- ·下一篇文章:开机通道批量升级迅闪还原脚本
- ·百度中搜索更多的关于“vbs实现更改显示操作系统列表的时间2008-05-26 16:31”相关内容
- ·谷歌中搜索更多的关于“vbs实现更改显示操作系统列表的时间2008-05-26 16:31”相关内容
- ******申明******
- 本站文章内容有部分为收录网络中其他网友内容,DOS资源站不保证所有的代码都适合你使用。
- 由于编辑匆忙,有可能造成某些脚本文件出现丢失代码或代码无法运行的情况,请网友根据情况自行修改。
- 如果能将出错部分反馈给我,那就更好了。
vbs实现更改显示操作系统列表的时间2008-05-26 16:31
'本脚本利用更改boot.ini文件的timeout的值来实现更改显示操作系统列表的时间
'script by breakan
option explicit
dim fso,open,ws,wsenv
dim attrib,boottime,bootini,timeline,boot_inipath,yon
set fso=createobject("scripting.filesystemobject")
set ws=wscript.createobject("wscript.shell")
set wsenv=ws.environment("PROCESS")
boot_inipath=wsenv("HOMEDRIVE") & "\boot.ini"
do
on error resume next
boottime=inputbox("请输入显示操作系统列表的时间:" & vbcr & "一定要是数字并且是整数,>=0,<=999","boot.ini","5")
if boottime="" and isnumeric(cint(boottime)) then
yon=msgbox("您没有填写任何正确的数字要重新填写吗?",4+32,"boot.ini")
if yon=7 then wscript.quit
else
exit do
end if
loop
call fileattrib '调用fileattrib过程更改boot.ini文件的属性
'更改boot.ini文件的timeout值
set open=fso.opentextfile(boot_inipath,1)
open.skipline '文件指针跳第二行,因为第二行就是timeout=那一行.
timeline=open.readline '读取第二行
open.close
set open=fso.opentextfile(boot_inipath,1)
bootini=replace(open.readall,timeline,"timeout=" & boottime) '更改timeout的值.
open.close
set open=fso.opentextfile(boot_inipath,2) '把更改后的内容写入boot.ini文件.
open.write bootini
open.close
call fileattrib '调用fileattrib过程改回boot.ini文件的属性
msgbox "已更改^-^"
'设置boot.ini文件的属性,这样才能改文件的内容
sub fileattrib
dim f
set f=fso.getfile(boot_inipath) '获取boot.ini文件
if f.attributes>0 and f.attributes<>32 then '因为修改boot.ini文件后,属性就自动变成32了,所以要不等于32
attrib=f.attributes
f.attributes=f.attributes-f.attributes '把boot.ini文件的属性设置为0
else
f.attributes=attrib '把boot.ini文件的属性还原
end if
end sub

