本帖最后由 afan 于 2010-7-11 21:00 编辑 Local $Str = _
'c:\windows\inf\net1394.inf ' & @CRLF & _
'c:\windows\inf\oem3.inf ' & @CRLF & _
'C:\WINDOWS\system32\drivers\agrsm.sys ' & @CRLF & _
'C:\WINDOWS\system32\agrsmsvc.exe ' & @CRLF & _
'C:\WINDOWS\agrsmdel.exe ' & @CRLF & _
'C:\WINDOWS\system32\agrscoin.dll ' & @CRLF & _
'c:\windows\inf\oem0.inf '
$Str = StringRegExpReplace($Str, '(\w\:\\(.+?))\h*(\r\n|$)', 'echo f\| xcopy \/s \/e \/f \/h "$1" "d\:\\DRVBACKUP\\$2"$3') ;一行即可,还补充了引号
MsgBox(0, '正则替换', $Str)
;实际应用为以下代码
;Local $Str = StringRegExpReplace(FileRead('drvback.inf'), '(\w\:\\(.+?))\h*(\r\n|$)', 'echo f\| xcopy \/s \/e \/f \/h "$1" "d\:\\DRVBACKUP\\$2"$3')
;FileWrite('drvbackup.bat', $Str)
|