回复 1# nai - strFile = "0.bat"
- strText = "@echo off" & vbCrLf & _
- "cd.>B.txt" & vbCrLf & _
- "for /f ""delims="" %%i in (A.txt) do (" & vbCrLf & _
- "find /i ""%%i"" B.txt||echo %%i>>B.txt" & vbCrLf & _
- ")"
- Set fso = CreateObject("Scripting.filesystemobject")
- set wTxt = fso.OpenTextFile(strFile, 2, True, 0)
- wTxt.Write strText
- wTxt.Close
- Msgbox "创建完成!"
复制代码 引号的处理
输出:复制代码 - '输出:符 "a" 文 "b"
- ' 1. 字符串内部使用 "" 转义
- str1 = "符 ""a"" 文 ""b"""
- ' 2. 字符串外部使用 Chr(34)
- str2 = "符 " & Chr(34) & "a" & Chr(34) & " 文 " & Chr(34) & "b" & Chr(34)
- Msgbox "str1=" & str1
- Msgbox "str2=" & str2
复制代码
|