我想将一段文字写入到文本中,但是又不想对这段文字做太多的处理,这个文本里还可能包含"等特殊的字符,请问大侠们有什么好的方法啊,我菜鸟一只,请大虾帮帮忙。举例:有如下面所示的一段文字,如何将他们直接写入到 C:\a.txt 中welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
welcome!
thanks!"welcome!
s="welcome!"&vbcrlf
s=s&"thanks!""welcome!"Set f = CreateObject("Scripting.FileSystemObject")
Set o = f.CreateTextFile("aaaaa.txt")
o.Write s
o.Close
set o=nothing
set f=nothing
wscript.echo "OK"
s="welcome!"&vbcrlf
s=s&"thanks!""welcome!"
这两行就是告诉你:那就是你的那段文本。
1、我上面的代码是直接写上去;直接写只好处理字串,没办法;
2、要是作为变量使用,那就要有另外一个程序调用这个VBS,并给一个参数。那VBS还要加参数判断:
第一行加:
s=wscript.arguments(0)3、正因为如此,我才有4楼的说法。明白了?