471,594 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

newgie string help please


hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren
Nov 15 '05 #1
10 1454
Darren-

By escaping it;

string s = "can you find the \" extra quote?";

But, if you add a quote to you string in the place you indicated, you will
have unbalanced quotes. What you want is for you string to look like this;

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r

So you would assign the string like this:

string s = "\"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe\" /r";

HTH
Brian W

<darren> wrote in message news:cl********************************@4ax.com...

hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren

Nov 15 '05 #2
Hi that line gets me a unrecognized escape sequence error

string s = "\"C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\" /r";

regards
Darren
On Sat, 14 Feb 2004 14:06:42 +0000, darren <> wrote:

hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren


Nov 15 '05 #3
darren wrote:
Hi that line gets me a unrecognized escape sequence error


Read the docs on strings you really must. Try this:

string s = "\"C:\\Documents and Settings\\Darren\\My Documents\\Visual
Studio Projects\\shorcut\\bin\\Debug\\shorcut.exe\\" /r";

--
gabriel
Nov 15 '05 #4
hi this just gives more errors

On Sat, 14 Feb 2004 17:10:13 +0000, gabriel <no@no--spam.com> wrote:
darren wrote:
Hi that line gets me a unrecognized escape sequence error


Read the docs on strings you really must. Try this:

string s = "\"C:\\Documents and Settings\\Darren\\My Documents\\Visual
Studio Projects\\shorcut\\bin\\Debug\\shorcut.exe\\" /r";


Nov 15 '05 #5
try this

string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";

<darren> wrote in message news:cl********************************@4ax.com...

hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren

Nov 15 '05 #6
copy and paste error ... don't include the last \
string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";
string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe"" /r";
"Du Dang" <vi*******@hotmail.com> wrote in message
news:M4******************@nnrp1.uunet.ca... try this

string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";

<darren> wrote in message

news:cl********************************@4ax.com...

hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren


Nov 15 '05 #7
hi ok thank for the ideas so far here is my small test program if
anyone can help that would be great i just want to make a
desktopshortcut whic also passes \r

regards
Darren

On Sat, 14 Feb 2004 14:06:42 +0000, darren <> wrote:

hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren


Nov 15 '05 #8
hi ok thank for the ideas so far here is my small test program if
anyone can help that would be great i just want to make a
desktopshortcut whic also passes \r

regards
Darren
On Sat, 14 Feb 2004 14:06:42 +0000, darren <> wrote:

hi iam righting aprogram that creates its own desktop shotcut and a
want to add a command line switch

so i want to have a string like this

"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r"

my problem is how do i get the single " quote mark into my string
please help

thanks
Darren


Nov 15 '05 #9

hi ok thank for the ideas so far here is my small test program if
anyone can help that would be great i just want to make a
desktopshortcut whic also passes \r

regards
Darren

On Sat, 14 Feb 2004 12:43:49 -0500, "Du Dang" <vi*******@hotmail.com>
wrote:
copy and paste error ... don't include the last \
string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";


string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe"" /r";
"Du Dang" <vi*******@hotmail.com> wrote in message
news:M4******************@nnrp1.uunet.ca...
try this

string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";

<darren> wrote in message

news:cl********************************@4ax.com.. .
>
> hi iam righting aprogram that creates its own desktop shotcut and a
> want to add a command line switch
>
> so i want to have a string like this
>
> "C:\Documents and Settings\Darren\My Documents\Visual Studio
> Projects\shorcut\bin\Debug\shorcut.exe" /r"
>
> my problem is how do i get the single " quote mark into my string
> please help
>
> thanks
> Darren



Nov 15 '05 #10
NOTE: ur program need one argument to run, since u have
if (args.Length == 1) restriction in the main function
if you don't want to impose this restriction simply remove the if statement

regard to the program itself

u need to change the value of the textbox to
"C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe" /r
because this is the actual command for shortcut
and change the s variable to
string s = @"""C:\Documents and Settings\Darren\My Documents\Visual Studio
Projects\shorcut\bin\Debug\shorcut.exe""";
beause link.cs only need this to figure out what is the name for your
shortcut

Link.Update(Environment.SpecialFolder.DesktopDirec tory,textBox1.Text, s
,true);

hope this help
<darren> wrote in message news:th********************************@4ax.com...

hi ok thank for the ideas so far here is my small test program if
anyone can help that would be great i just want to make a
desktopshortcut whic also passes \r

regards
Darren

On Sat, 14 Feb 2004 12:43:49 -0500, "Du Dang" <vi*******@hotmail.com>
wrote:
copy and paste error ... don't include the last \
string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";


string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe"" /r";
"Du Dang" <vi*******@hotmail.com> wrote in message
news:M4******************@nnrp1.uunet.ca...
try this

string s = @"""C:\Documents and Settings\Darren\My Documents\Visual
Studio Projects\shorcut\bin\Debug\shorcut.exe\"" /r";

<darren> wrote in message

news:cl********************************@4ax.com.. .
>
> hi iam righting aprogram that creates its own desktop shotcut and a
> want to add a command line switch
>
> so i want to have a string like this
>
> "C:\Documents and Settings\Darren\My Documents\Visual Studio
> Projects\shorcut\bin\Debug\shorcut.exe" /r"
>
> my problem is how do i get the single " quote mark into my string
> please help
>
> thanks
> Darren

Nov 15 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jesse | last post: by
9 posts views Thread by Derek Hart | last post: by
7 posts views Thread by Ahmad A. Rahman | last post: by
2 posts views Thread by I am Sam | last post: by
1 post views Thread by A Hirsi | last post: by
22 posts views Thread by Amali | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | 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.