dos(批处理)或VBS脚本批量修改CSV格式文件内容
我有很多个文件夹,比如A1001,A1002,A1003文件夹内有文件有比如A1001文件里有:A1001TA1001HA1001W三个CSV文件,我要批量替换A1001...
我有很多个文件夹,比如A1001 ,A1002,A1003 文件夹内有文件有比如A1001文件里有:A1001T A1001H A1001W三个CSV文件,我要批量替换A1001T 内第二列和第六列的内容“端子”替换为 “TER”请问该如何写,谢谢!!
展开
展开全部
set fso=createobject("scripting.filesystemobject")
set fols=fso.getfolder("C:\P")
for each fol in fols.subfolders
folPath = fol.path
folName = fol.name
File1 = folPath & "\" & folName & "T.CSV"
set f = fso.opentextfile(File1)
text = f.readall
f.close
fso.deletefile File1
arrT = split(text,vbcrlf)
SS=""
for i = 0 to ubound(arrT)
if arrT(i) <> "" then
ArrS = split(arrT(i),",")
ArrS(1)="TER"
ArrS(5)="TER"
s = join(ArrS,",")
end if
SS = SS & s & vbcrlf
next
set f = fso.createtextfile(File1)
f.write SS
f.close
next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |