By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

newgie string help please

P: n/a

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
Share this Question
Share on Google+
10 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

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

P: n/a
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.