While creating shortcut slash changes to backslash

I

Ilya

Hi, all!

Some weird thing happens...
I'm trying to create a shortcut programmatically in C#. I need to
create a shortcut with the "target" parameter using slash. Actually
I'm creating a shortcut to a file using command line arguments, smth
like:
"C:\PATH\MyFile.exe" /param1
The problem is that when I create a shortcut the regular slash that
comes before param1 changes to backslash. I checked it in the
debugger. The string that's passed to a function that creates the
shortcut itself has a slash, but the shortcut after creation has
backslash instead. And it ruins the launch of the app because command
line argument is not recognized.
I tried to create a shortcut in 2 ways:
1. Using the code from http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp.
2. Using shell functions.
Both lead to the same result.

Anybody has idea what can I do?

Thanks in advance,
Ilya
 
B

Ben Voigt [C++ MVP]

Ilya said:
Hi, all!

Some weird thing happens...
I'm trying to create a shortcut programmatically in C#. I need to
create a shortcut with the "target" parameter using slash. Actually
I'm creating a shortcut to a file using command line arguments, smth
like:
"C:\PATH\MyFile.exe" /param1

Did you put all of that in the shortcut target? The "/param1" part needs to
be put into the arguments field instead.
 
I

Ilya

Did you put all of that in the shortcut target? The "/param1" part needs to
be put into the arguments field instead.

Hi, Ben!

Thanks a lot for your reply.
Tried the arguments section and it worked perfectly!

Ilya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top