本帖最后由 Nsqs 于 2016-12-8 17:20 编辑
- :on error resume next
- :sub class_bat
- ' 2>nul&echo off&cls
- cscript -nologo -e:vbs "%~0"
- pause
- exit sub
- :end sub
- set fso=createobject("scripting.filesystemobject")
- set regexp=new regexp
- set f=fso.getfolder(".")
- regexp.global=-1:regexp.ignorecase=-1
- regexp.pattern="(.*)(bb|cc)"
- wsh.echo "演示结果:"
- for each list in f.files
- if fso.getextensionname(list)="txt" then
- wsh.echo string(15,"-"),fso.getfilename(list),string(15,"-")
- read=fso.opentextfile(list).readall
- change=RegExp.Replace(read,"$1")
- fso.createtextfile(file).write change
- wsh.echo change
- end if
- next
- set f=nothing:set fso=nothing:set regexp=nothing
复制代码
|