Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escape Quotes 1

Status
Not open for further replies.

twooly

MIS
Feb 22, 2004
122
US
Can someone tell me how I can escape quotes in a line?
Basicly I need the quotes around the directory since there is a space in it.

strCommand = "cacls "C:\Program Files\Program" /T /E /P Users:C"

Thanks
 
There are various ways to do this. Here are two:
Code:
Option Explicit

Dim strCommand

strCommand = "cacls " & """C:\Program Files\Program""" & " /T /E /P Users:C"
WScript.Echo strCommand

strCommand = "cacls " & Chr(34) & "C:\Program Files\Program" & Chr(34) & " /T /E /P Users:C"
WScript.Echo strCommand

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top