求用vbs编辑txt文件的小程序,做成后追加全部积分

来源:百度知道 编辑:UC知道 时间:2024/07/07 16:44:15
第一个问题
*.TXT文件中有一列如下数据,大约几百个
1
8
12
96
112
698
1233
20021
200144
希望能用VBS程序把上述数据中不足6位的在前面加0补齐.
第二个问题:
把上面处理好的数据前面加上指定的字母如"MN"
最好是做成两个小程序

感激不尽!!!!!!!!!!!!!
希望能解释一下程序语言

按你的要求做两个VBS.
第一个VBS如下:
set fso=createobject("scripting.filesystemobject")
set file=fso.opentextfile("text.txt")
do while file.atendofstream<>true
h=file.readline
if len(h)<6 then
n=right("000000" & h,6)
else
n=h
end if
s=s&n&vbcrlf
loop
file.close
set file=fso.createtextfile("#text.txt")
file.write s
file.close
msgbox "文件处理完毕!请查看#text.txt文件!",4096

第二个VBS内容如下:
set fso=createobject("scripting.filesystemobject")
h=inputbox("请输入您要加的字符:","提示","MN")
if h=false then wscript.quit
set file=fso.opentextfile("#text.txt")
do while file.atendofstream<>true
n=h & file.readline
s=s&n&vbcrlf
loop
file.close
set file=fso.createtextfile("MN#text.txt")
file.write s
file.close
msgbox "文件处理完毕!请查看MN#text.txt文件!",