Alenhj
Alenhj

Reputation: 109

Trying to create vbs file programmatically

I am writing a vb.net application that creates a vbs file. I've created the file and tested sending a line of text to it with no trouble. However, the second line has a problem.

File.WriteLine("set WshShell = CreateObject("WScript.Shell")")

After the second quotation mark it stops reading it as a string or text. What am I missing?

Upvotes: 1

Views: 373

Answers (1)

Mike
Mike

Reputation: 6050

To represent a double quotation mark you escape it by putting two in a row

File.WriteLine("set WshShell = CreateObject(""WScript.Shell"")")

The funny thing is that even Stack Exchange markup also recognizes this

Upvotes: 5

Related Questions