冰肌白有用吗,跨越母亲的河,防御小游戏
那天跟别人聊到 y2k38 问题,于是想到一个恶作剧:用 vbs 把系统的时间修改到2038年1月19日3时14分07秒之后,这样某些依赖于 unix 时间戳的程序就会出问题。那么怎样用 vbs 修改系统的时间呢?
最简单也是最没有技术含量的方法就是调用 cmd 的 date 和 time 命令:
'author: demon
'website: http://demon.tw
'date : 2011/4/27
dim wshshell
set wshshell = createobject("wscript.shell")
wshshell.run "cmd.exe /c date 2038-01-19", 0
wshshell.run "cmd.exe /c time 3:14:08", 0
比较有技术含量的方法是用 wmi 的 win32_operatingsystem 类的 setdatetime 方法:
'author: demon
'website: http://demon.tw
'date : 2011/4/27
dtmnewdatetime = "20380119031408.000000+480" 'utc时间
strcomputer = "."
set objwmiservice = getobject("winmgmts:{(systemtime)}\\" & strcomputer & "\root\cimv2")
set coloses = objwmiservice.execquery("select * from win32_operatingsystem")
for each objos in coloses
objos.setdatetime dtmnewdatetime
next
windows 7 在开启 uac 的情况下需要管理员权限才能修改时间,一点也不好玩。
参考链接:
来自:
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论