views:

28

answers:

3

I have a desktop application which reads files from a specified folder, then deposits the files to a folder in a third party document management system based on criteria that the user provides.

My question is:

is it possible to somehow provide different parameters to the code, depending on which shortcut of the application the user clicked on to start it up?

A: 

Yes.

The easiest way would be to have the shortcut pass those parameters in via the command line.

Stephen Wrighton
can you explain how i would do that? IE, where would i write the code,and what kind of code would i be writing?
I dont know if i was clear, but the user will not start the application via the commnad line. they will need to start it from a desktop icon.thanks
@user I added an answer that I think answers your question.
Ben McCormack
A: 

You could also use conditional compilation variables, and have 2 different .exes. You should be able to find samples of both approaches (command line and conditional compilation variable) in help.

Beth
what do you mean by help?
MS help files embedded into the product, online samples, Microsoft's knowledge base, or Google.
Beth
A: 

You can add command line parameters to a shortcut icon. Here's how you can do it in Windows:

  • On the Start Menu, navigate to Notepad.
  • Right click on Notepad and choose Send To > Desktop (Create Shortcut)
  • Right click on the newly-created desktop icon and choose Properties
  • Add your command line parameters to the Target text box.

    • For example, if you want notepad to open up the hosts file, this would be the content of Target property:

      %SystemRoot%\system32\notepad.exe "C:\WINDOWS\system32\drivers\etc\hosts"

You can put pretty much anything into the Target property of a shortcut that you would put into a command line.

Ben McCormack
thanks a lot. that should do it i think