How would I pass my program a string from the start menu search in Windows (like ping)?
When my program is launched from the start menu shortcut I would like to send it a string. I see that ping does this because I can type in ping [and a domain] and it will pop the cmd window and do the ping. However I think this must be working differently than what I have setup because even though the shortcut to the program is in the start menu, it will disappear when I am searching for it as soon as I start typing any parameters. Then windows will just launch a windows explorer window attempting to search for what I typed. What must I do to get it to register like the ping program?
Also, do you think it is j开发者_运维知识库ust using the string[] args
to capture this?
Did you try running your program from CMD and passing the parameters from there? Something like: <path to your executable> <arg1> <arg2>...<arg N>
And yes, any parameters that are given to the program (as shown above) are then available in the args
variable that the main method takes.
精彩评论