Andy Brown
asked on
Extracting a hyperlink from the command line
I'm new to c# and need a bit of guidance on something that I fear is very obvious (but haven't figured out). I want to pass a hyperlink via the command line to a variable called strHyperlink. I was thinking of something like this for the command line:
D:\Testbed\Sandbox.exe http://website.com
I have added the variable to the Form class
However, when I try to view the switch using the following:
I get:
"D:\Testbed\Sandbox.exe http://website.com"
Can someone please let me know how to get the hyperlink (in the cleanest possible way). Thank you.
D:\Testbed\Sandbox.exe http://website.com
I have added the variable to the Form class
string strHyperlink = Environment.CommandLine;
However, when I try to view the switch using the following:
var result = MessageBox.Show(strHyperlink, "Test", MessageBoxButtons.OK, MessageBoxIcon.Information);
I get:
"D:\Testbed\Sandbox.exe http://website.com"
Can someone please let me know how to get the hyperlink (in the cleanest possible way). Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great stuff - thank you.
duh, I gave you the vb version for some reason.
Note you also need to check that there are more than 1 arguments (the first one is the application iteself)
Note you also need to check that there are more than 1 arguments (the first one is the application iteself)
welcome happy to help.
ASKER
Thank you both.
arguments(1) contains the hyperlink