473,788 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

While creating shortcut slash changes to backslash

Hi, all!

Some weird thing happens...
I'm trying to create a shortcut programmaticall y 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/s..._shelllink.asp.
2. Using shell functions.
Both lead to the same result.

Anybody has idea what can I do?

Thanks in advance,
Ilya
Jun 27 '08 #1
2 2834
Ilya wrote:
Hi, all!

Some weird thing happens...
I'm trying to create a shortcut programmaticall y 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.
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/s..._shelllink.asp.
2. Using shell functions.
Both lead to the same result.

Anybody has idea what can I do?

Thanks in advance,
Ilya

Jun 27 '08 #2
On Apr 21, 7:36 pm, "Ben Voigt [C++ MVP]" <r...@nospam.no spamwrote:
Ilya wrote:
Hi, all!
Some weird thing happens...
I'm trying to create a shortcut programmaticall y 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.
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/s..._shelllink.asp.
2. Using shell functions.
Both lead to the same result.
Anybody has idea what can I do?
Thanks in advance,
Ilya
Hi, Ben!

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

Ilya
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2531
by: Xaradas | last post by:
Someone could tell me why preg_replace eat a slash when it do replacement? <? $stringToReplace = "blah blah {nome} blah blah"; $replacement = "Two slash: \\\\"; $stringToReplace = preg_replace("/{nome}/Us",$replacement,$stringToReplace,1); echo($stringToReplace); #
30
75128
by: Stephen Ferg | last post by:
I have a question that is not directly Python-related. But I thought I'd ask the most erudite group that I know... :-) When did Windows start accepting the forward slash as a path separator character? At one time, it was accepted as a truism that Windows (like MS-DOS) was different from Unix because Windows used the backslash as the path separator character, whereas Unix used the forward slash.
0
873
by: Mark | last post by:
I am using VB.Net 2003. I have an application that is executed by dropping a file on a shortcut. If I use a shortcut that was created through VB.Net the application doesn't work and shows a circle with a slash through it when I try dropping a file onto the shortcut. If I create a shortcut by right-dragging it to the desktop the alpplication will work as expected. Any ideas what can be done to fix this? Thanks in advance. Mark
1
15213
by: Kberg | last post by:
In case anyone is interested, this is how I solved the problem of replacing a back slash with a forward slash (as in being able to access a document on a file share on an intranet via a browser) if you cut and paste a path from windows explorer \\myshare\mydir\mydoc.txt into a form textbox, you can use the following code to transform it into something usable by a browser: mytxt = document.myForm.myTextBox.value; mytxt =...
2
2518
by: urrahul | last post by:
Hi All, Iam using the following JavaScript to create desktop shortcut function createShortcut() { if (ActiveXObject) { // Create desktop shortcut WshShell = new ActiveXObject( "WScript.Shell" ); strDesktop = WshShell.SpecialFolders("Desktop"); oShellLink = WshShell.CreateShortcut(strDesktop + "\\My Shortcut.lnk");
7
2963
by: abcd | last post by:
When do I need to use a trailing slash to separate code over multiple lines. For example: x = "hello world, this is my multiline " + \ "string!!!!" x = {'name' : \ 'bob'}
23
13527
by: dkirkdrei | last post by:
I am having a bit of trouble trying to double up on slashes in a file path. What I am trying to do is very similar to the code below: <? $var = "\\wusais\Intranets\Intranets\fpdb\pdf\weinig\00505882.pdf"; $new = preg_replace("\\", "\\\", "$var"); ?> Code above produces the following error:
15
2515
by: Mike Driscoll | last post by:
Hi, I've had this niggling issue from time to time. I want to create a shortcut on the user's desktop to a website that specifically loads Firefox even if Firefox is not the default browser. I usually use COM as it allows very specific settings of the shortcut, such as the Working Directory and the Target Path. However, the following will not work for some reason:
4
4356
by: RvGrah | last post by:
If I add "string args" to the Program.cs file so that there can be arguments passed when the program launches, how do I add those to a fixed desktop shortcut on my users' machines? And If I'm launching said program from a System.Diagnostics.Process.Start line of code how would I do it there? OK, I could probably figure out that second one myself but I haven't been able to search and find an answer on the first question. Bob
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.