用vbs遍历文件并随机显示的脚本
程序员文章站
2022-04-10 08:07:09
set ws=createobject("wscript.shell") set fso=createobject("scripting.filesys...
set ws=createobject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
set folder=fso.getfolder(ws.currentdirectory)
set files=folder.files
for each file in files
d=d & file.name & ","
next
randomize
do until d = ""
s = split(d, ",")
m = ubound(s)
h = int(rnd * m)
n = s(h)
sn = sn & n & vbcr
d = replace( d, n & ",", "",1,1)
loop
msgbox sn
set fso=createobject("scripting.filesystemobject")
set folder=fso.getfolder(ws.currentdirectory)
set files=folder.files
for each file in files
d=d & file.name & ","
next
randomize
do until d = ""
s = split(d, ",")
m = ubound(s)
h = int(rnd * m)
n = s(h)
sn = sn & n & vbcr
d = replace( d, n & ",", "",1,1)
loop
msgbox sn
上一篇: VBS读网页的代码
下一篇: 用vbs实现显示系统调色板的代码