批处理
请教一个批处理,将文件中的字符串"date=2012-03-04"替换为"date=2012-06-12"
注意:是替换"date=2012-03-04",只有"2012-03-04"的不替换
------解决方案--------------------http://topic.csdn.net/u/20080819/22/14af598e-56fd-4201-968d-b3aa05537ad8.html
------解决方案--------------------[code=BatchFile]@if (1==1) @end/*
@echo 正在替换,请稍候...
@cscript -e:jscript "%~f0">nul
@echo 完成!按任意键退出...&pause>nul
@goto :eof*/
o = new ActiveXObject("Scripting.FileSystemObject")
f = o.OpenTextFile("a.txt", 1)
s = f.ReadAll()
f.Close()
delete f
f = o.OpenTextFile("a.txt", 2)
f.Write(s.replace(/date=2012-03-04/g, "date=2012-06-12"))
f.Close()
delete f
delete o[/code]