Vb.net shortcut

Hi,

I`m wondering if it's possible to use the RUN command in windows to launch my vb.net application but also to send commands to it before it opens,

Such as,

START->RUN

myapplication -search 14564

when my app opens it knows that there's a command and it needs to filter the results for 14564

would this be possible?
FCapoAsked:
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.

dustockCommented:
Have you tried to wrap the application path in double quotes then add the command?

"c:\temp\myapp.exe" -search 14564
0
FCapoAuthor Commented:
Yes but my question was what do I need to add in my Vb.net Application for it to recognize -search 14564 as a command?
0
dustockCommented:
Sorry, misread the question.  Is this a console application or windows forms application?
0
FCapoAuthor Commented:
windows forms application
0
dustockCommented:
In the load event for the form add a String array that looks for the Command Line Args.  Then verify it has "-search" in it, if so then pass the 3rd argument in the loop (your search criteria) into what ever function you use to search.  Your selecting the 3rd argument because when the app runs it see itself as an argument, then it sees -search then it will see the next value.  Also, double quotes are not required to run this from start>run

You'll want to include some error checking here too!

        Dim passedArgs() As String = Environment.GetCommandLineArgs

        If passedArgs.Contains("-search") Then
            Search(passedArgs(2))
        End If

Open in new window


eg
c:\temp\myapp.exe -search 14564

will pass 14564 into the search function in the code block above.
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
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
Visual Basic.NET

From novice to tech pro — start learning today.