VB 更改或删除特殊字符的脚本

VB Script to change or strip out special characters

我有一个小的 VB 脚本(见下文),我通过 google 找到了它,它的作用是在 [=18= 中找到这个字符串 (H*699557/1A) ] 文件并将文件名重命名为该字符串,这非常有效,直到它遇到一个特殊字符(如字符串示例中所示)然后停止。

谁能帮我删除特殊字符,感谢任何帮助。

Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = "C:\vbs"
Set objFolder = objFS.GetFolder(strFolder)

Set regEx = New RegExp  
regEx.Pattern = ".*<SuppliersInvoiceNumber>(.*?)</SuppliersInvoiceNumber>.*"
regEx.IgnoreCase = True 
regEx.MultiLine = True

For Each strFile In objFolder.Files
    strFileName = strFile.Name 
    If InStr(strFileName ,"USI") > 0 Then
        Set objFile=objFS.OpenTextFile(strFileName)
        strData = objFile.ReadAll 
        Set objFile=Nothing
        Set colMatches = regEx.Execute(strData)
        For Each objMatch In colMatches
           strNew = Split(objMatch.Submatches(0),"\")
           strNewFile = strNew(0)
           strFile.Name = strNewFile & ".xml"
        Next
    End If
Next
Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = "C:\vbs"
Set objFolder = objFS.GetFolder(strFolder)

Set regEx = New RegExp  
regEx.Pattern = ".*<SuppliersInvoiceNumber>(.*?)</SuppliersInvoiceNumber>.*"
regEx.IgnoreCase = True 
regEx.MultiLine = True

For Each strFile In objFolder.Files
    strFileName = strFile.Name 
    If InStr(strFileName ,"USI") > 0 Then
        Set objFile=objFS.OpenTextFile(strFileName)
        strData = objFile.ReadAll 
        Set objFile=Nothing
        Set colMatches = regEx.Execute(strData)
        For Each objMatch In colMatches
           strNew = Split(objMatch.Submatches(0),"\")
           strNewFile = strNew(0)
           strFile.Name = Replace(Replace(strNewFile,"*",""),"/","")  & ".xml"
        Next
    End If
Next