-
Sep 23rd, 2012, 09:11 AM
#1
Thread Starter
Lively Member
[RESOLVED] C# Targetpath shortcuts
I have a small problem with generating the shortcut. Actually generating shortcut works no problem but I wont to add other few lines to shortcut that makes me problems that I chouldnt work out. For example :
I need to have the path of my shortcut like this : C:\test.vbs "C:/somefile.exe" somedata email@gmail.com password
I use this code :
Code:
MyShortcut.TargetPath = @"C:/test.vbs" + textBox3.Text + " " + comboBox1.Text + " " + textBox1.Text + " " + textBox2.Text;
textbox3 is path of somefile. somedata is selected item from combobox. textbox1 is email. textbox2 is password
I can not add the path on textbox3 ( C:/somefile.exe ) the program gets error. what am I doing wrong here ?
-
Sep 23rd, 2012, 09:15 AM
#2
Member
Re: C# Targetpath shortcuts
I am guessing that you forgot to put space
Code:
MyShortcut.TargetPath = @"C:/test.vbs " + textBox3.Text + " " + comboBox1.Text + " " + textBox1.Text + " " + textBox2.Text;
-
Sep 23rd, 2012, 09:25 AM
#3
Thread Starter
Lively Member
Re: C# Targetpath shortcuts
nope it gives me error unhandled exeption again. If I do not put the textbox3 filepath it works with it it doesnt. or if I put only the exe name like : somefile.exe it works also not with C:/somefile.exe
-
Sep 23rd, 2012, 09:57 AM
#4
Re: C# Targetpath shortcuts
Well I know nothing about C# but I'm pretty certain you don't use C:/ in a path. Shortcuts aren't urls, are they?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 23rd, 2012, 10:12 AM
#5
Thread Starter
Lively Member
Re: C# Targetpath shortcuts
Shortcut is should be like this : C:\test.vbs "C:/somefile.exe" somedata email@gmail.com password
-
Sep 23rd, 2012, 10:25 AM
#6
Re: C# Targetpath shortcuts
Er ... the fact that you can't make it work suggests otherwise! If C:/somefile.exe is intended as an url then it should surely be file:///C:/somefile.exe and if it's not (which the fact that you can use it with just somefile.exe certainly suggests) it should be C:\somefile.exe
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 23rd, 2012, 10:30 AM
#7
Re: C# Targetpath shortcuts
That looks more like a command string than a shortcut. Shortcuts are ONLY file paths such as C:\someFolder\somefile.exe
shortcut.TargetPath should work perfectly with just "C:\test.vbs".
-
Sep 23rd, 2012, 10:33 AM
#8
Thread Starter
Lively Member
Re: C# Targetpath shortcuts
sure it works with just a path , if you guys think it looks like a command path YES but how can I do it .
-
Sep 23rd, 2012, 10:35 AM
#9
Re: C# Targetpath shortcuts
Originally Posted by españolito
That looks more like a command string than a shortcut. Shortcuts are ONLY file paths such as C:\someFolder\somefile.exe
shortcut.TargetPath should work perfectly with just "C:\test.vbs".
You can use command strings in a shortcut so that's not a problem in itself. I'm assuming that the values given here are just placeholders and not the actual values, of course.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 23rd, 2012, 10:37 AM
#10
Thread Starter
Lively Member
Re: C# Targetpath shortcuts
Originally Posted by dunfiddlin
You can use command strings in a shortcut so that's not a problem in itself. I'm assuming that the values given here are just placeholders and not the actual values, of course.
any example ?
-
Sep 23rd, 2012, 10:44 AM
#11
Re: C# Targetpath shortcuts
This is my shortcut for a well known game ...
"C:\Program Files\Out of the Park Developments\OOTP Baseball 13\ootp13.exe" load_league=Play At The Plate.lg
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 24th, 2012, 05:15 AM
#12
Re: C# Targetpath shortcuts
Originally Posted by RapidBuster
I am guessing that you forgot to put space
Possibly also the Double Quotes.
Looking at dunfiddlin's shortcut, the filepath is enclosed in quotes and the command string follows, separated by spaces.
-
Sep 24th, 2012, 06:14 AM
#13
Thread Starter
Lively Member
Re: C# Targetpath shortcuts
well I need my shortcut exact like this :
if anyone can give me an examle on how to do this whould be very nice thank you .
-
Sep 24th, 2012, 06:27 AM
#14
Re: C# Targetpath shortcuts
I did this test and it generates the correct string with the correct quotes as per dunfiddlin's post
Code:
Label1.Text = """C:/test.vbs""" + " " & TextBox3.Text + " " + TextBox4.Text + " " + TextBox1.Text + " " + TextBox2.Text
Obviously, you'd need to change the variable names and also bear in mind this is VB, not C# so you'd need to put the @ and the ; back
Attachment 91669
Last edited by Españolita; Sep 24th, 2012 at 06:34 AM.
Reason: add screenshot
-
Sep 24th, 2012, 06:51 AM
#15
Thread Starter
Lively Member
Re: C# Targetpath shortcuts
I have now like this changed my code , sorry @españolito didnt work in C#
shortcut.TargetPath = "\"C:\\file.exe\"";
shortcut.Arguments = "/" + textBox3.Text + "/" + " " + comboBox1.Text + " " + textBox1.Text + " " + textBox2.Text;
this works great , instead of / I need to add " but cant
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|