Writing a line in a file with quotes

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 15 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
jimbo101974
Posts: 40
Last visit: Mon Jan 12, 2009 4:52 am

Writing a line in a file with quotes

Post by jimbo101974 »

I am using the FileSystemObject to modify a text file. The line I am adding needs quotes. I have tried the following with the described result.

filetext.WriteLine("iSyntaxServer = '"129.168.128.10'")
and
filetext.WriteLine("iSyntaxServer = "192.168.128.10"")

both result in "Expected ')' on line 29"

How do I add quotes?
User avatar
jimbo101974
Posts: 40
Last visit: Mon Jan 12, 2009 4:52 am

Writing a line in a file with quotes

Post by jimbo101974 »

I am using the FileSystemObject to modify a text file. The line I am adding needs quotes. I have tried the following with the described result.

filetext.WriteLine("iSyntaxServer = '"129.168.128.10'")
and
filetext.WriteLine("iSyntaxServer = "192.168.128.10"")

both result in "Expected ')' on line 29"

How do I add quotes?
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Writing a line in a file with quotes

Post by jhicks »

Use the CHR function.filetext.WriteLine "iSyntaxServer = " & CHR(34) & "129.168.128.10" & CHR(34)
This topic is 15 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked