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
string strHyperlink = Environment.CommandLine;

Open in new window


However, when I try to view the switch using the following:

var result = MessageBox.Show(strHyperlink, "Test", MessageBoxButtons.OK, MessageBoxIcon.Information);

Open in new window


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.
Andy BrownDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Dim arguments As String() = Environment.GetCommandLineArgs()
arguments(1) contains the hyperlink
0
Pawan KumarDatabase ExpertCommented:
String[] args = Environment.GetCommandLineArgs();
args[1] --will have your hyperlink
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andy BrownDeveloperAuthor Commented:
Great stuff - thank you.
0
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

AndyAinscowFreelance programmer / ConsultantCommented:
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)
0
Pawan KumarDatabase ExpertCommented:
welcome happy to help.
0
Andy BrownDeveloperAuthor Commented:
Thank you both.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.