set folder=fso.getfolder("D:\photos") '改成文件夹的路径
set files=folder.files
for each file in files
ext=fso.getExtensionName(file)
if ext ="txt" then
set fread = fso.opentextfile(file.path,1)
str = ""
do until fread.atendofstream
strline=fread.readline
if left(strline,8) ="hostname" then
str = right(strline,len(strline)-8)
str =replace(str," ","")&"."&ext
exit do
end if
loop
fread.close
if file.name <>str then
file.name = str
end if
end if
next
————————————————————————————
以上代码需要保证hostname 后面的文字不能重复,因为文件名称是不能完全相同的。
set fso=createobject("scripting.filesystemobject")dim filename1 ,filename2 as string
i=1
do
filename1="d:\" &i &".txt"
filename2="F:\bak\" &i &".txt"
fso.copyfile filename1,filename2
i=i+1
wscript.sleep 1000*60*1
loop
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)