找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 14806|回复: 1

[问题求助] 求VBS修改文件夹下指定文本文件里的内容

[复制链接]
发表于 2017-5-28 10:38:08 | 显示全部楼层 |阅读模式
1,想要修改C:\Agilent_ICT\boards里的所有文件夹里子文件夹的文本的内容,
C:\Agilent_ICT\boards\DG52A_NMB245R10\D05
C:\Agilent_ICT\boards\DG100_NMB241R10\D06
C:\Agilent_ICT\boards\DG800_NMB243R10\L09
比需要把D05文件夹里的名为testplan1和testplan2的文本(无格式文本),里面一个字符kite换成上一级文件夹的名字前五位字符如DG52A。
2.有的文件里只有testplan1,有的文件里testplan1和testplan2都有

求大神
 楼主| 发表于 2017-5-28 12:38:09 | 显示全部楼层
  1. currentpath = createobject("Scripting.FileSystemObject").GetFolder(".").Path
  2. msgbox (currentpath)  
  3.                                                       
  4. MsgBox ("Please check the board name , is ok ?")
  5. MsgBox Mid (currentpath,23,5)            
  6.    


  7. set fso=createobject("scripting.filesystemobject")
  8. set fil=fso.opentextfile("testplan")
  9. s=fil.readall
  10. fil.close
  11. set fi=fso.opentextfile("testplan",2)
  12. Rem s=Replace(s,"global IYET_Analog_Tests_Attempts, IYET_VectorlessTest_Attempts","global kite_name$, IYET_Analog_Tests_Attempts, IYET_VectorlessTest_Attempts"& vbcrlf &"kite_name$=aaa")
  13. s=Replace(s,"report is FailRep_Path$&Serial$(1)&","report  is  FailRep_Path$&Serial$(1)&'_'& 'kite_name'&")
  14. s=Replace(s,"kite_name",Mid (currentpath,23,5))
  15. fi.write s
  16. fi.close
复制代码
目前只能放在文件同一路径下修改,怎么才能放在上一级就可以修改子文件夹里的所有testplan的内容,
求高手修改
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 07:43 , Processed in 0.067698 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表