471,317 Members | 1,459 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

Quotation marks in string arguments


My Windows service includes the following lines:

string Arguments3 = @"%OvAgentDir%\bin\OpC\cmds\ref-ovo-services.vbs
ServiceApplicatif ServiceOVO";
string expandedArguments3 =
Environment.ExpandEnvironmentVariables(Arguments3) ;
this.process3.StartInfo.Arguments = expandedArguments3;
this.process3.StartInfo.FileName = "cscript.exe";

ref-ovo-service.vbs runs with two arguments: ServiceApplicatif (windows
service) and ServiceOVO. Service applicatif can have a space in the
name.

My problem is to interger quotation marks on both sides of
ServiceApplicatif in the case of my Service Applicatif has a space.

\" on both sides of the command in this.process3.StartInfo.FileName =
"\"cscript.exe\""; works all right but not in string Arguments3

Thanks for any advices.
Bruno

Feb 3 '06 #1
2 6194
You need to use double double quotes (if you see what I mean) in verbatim
strings to represent a single double quotes.

"\"cscript.exe\""

but if prefixed with @,

"""cscript.exe""";

<bc*******@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...

My Windows service includes the following lines:

string Arguments3 = @"%OvAgentDir%\bin\OpC\cmds\ref-ovo-services.vbs
ServiceApplicatif ServiceOVO";
string expandedArguments3 =
Environment.ExpandEnvironmentVariables(Arguments3) ;
this.process3.StartInfo.Arguments = expandedArguments3;
this.process3.StartInfo.FileName = "cscript.exe";

ref-ovo-service.vbs runs with two arguments: ServiceApplicatif (windows
service) and ServiceOVO. Service applicatif can have a space in the
name.

My problem is to interger quotation marks on both sides of
ServiceApplicatif in the case of my Service Applicatif has a space.

\" on both sides of the command in this.process3.StartInfo.FileName =
"\"cscript.exe\""; works all right but not in string Arguments3

Thanks for any advices.
Bruno

Feb 3 '06 #2
Hi Clive,

Thanks for answering

I gonne test right now with 2 quotes

string Arguments3 = @"%OvAgentDir%\bin\OpC\cmds\ref-ovo-services.vbs
""ServiceApplicatif"" ServiceOVO";

Have a good day
Bruno

Feb 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Stephen Poley | last post: by
63 posts views Thread by Tristan Miller | last post: by
4 posts views Thread by | last post: by
31 posts views Thread by The Bicycling Guitarist | last post: by
12 posts views Thread by Adam Right | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.