IMPhill

I have been making a bat file creator for the past week now and im almost done.
However when you run a batch file with a path more then 8 chartors long you need a " at the start and end of the folder/file path. i have the output text going into a textbox then into the .bat file.

How would i do this because i cant seem to find any way of doing this.



Re: Visual Basic Language Need to add a " to my output file.

ahmedilyas

just add 2 quotes around the single quote...example:

"""

there are 3 quotes overall to write a single quote.






Re: Visual Basic Language Need to add a " to my output file.

IMPhill

I tried that and my code look like this:

"copy" + " " + """ + Text2.Text + """ + " " + Text3.Text

and my output was this:

copy " + Text2.Text + " E:\Documents and Settings\Administrator\Desktop

Is there any other way of doing this





Re: Visual Basic Language Need to add a " to my output file.

ahmedilyas

for string concatination in VB.NET/VB - its best to use the & symbol.

To do what you are asking..... try this:

Dim myString as String = "copy " & """" & Me.Text2.Text & """" & Me.Text3.Text

so its 4 quotes to put in a quote, not 3 as i stated earlier - my apologies.






Re: Visual Basic Language Need to add a " to my output file.

James A. Gayhart

Here's another way:

Code Snippet

Dim sCmd As String = _

String.Format("COPY {0}{1}{0} {2}", ControlsChars.Quote, Text2.Text, Text3.Text)