0

This question already has an answer here:

You can run some exe files from cmd.exe providing arguments.

example

P:\foo\boo “” user pass P:\system\ company foo –P boo

Is there any way to actually find out what parameters an exe can take?

Obviously I don't have access to the source code of a specific exe. All I am trying to find out is if it is possible without the owner's manual/docs to actually know what parameters can be passed. I am open to a solution involving reflection in C# etc

Any insights on this will be very helpful

marked as duplicate by JdeBP, Tog, Heptite, Kevin Panko, Dave Mar 10 '14 at 9:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Your first port of call should be trying to run the exe from the command-prompt with /? which shows the help page for a given command/program e.g. fc /?

/A Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
...

Alternatively, you can enter help executableName which does the same thing.

This may also work for some third-party programs if they are designed for use with the command prompt, but they are not many.

  • can you please show an example for like Notepad? I can't get the right syntax for this – user305298 Mar 5 '14 at 16:24
  • Notepad doesn't support a help page. cmd does, however. Try help cmd or cmd /? Windows is a little inconsistent with how help pages are displayed though, since mstsc /? produces it's help page in a separate window – Hugo Buff Mar 5 '14 at 16:39
0

Process Explorer has the functionality to do this. Open your program normally and then launch process explorer. Open its properties and take a look at the "Strings" tab. Most of these strings won't mean anything, but the ones that do could well be command-line switches. Test each of them in turn until you have a definitive list. Unfortunately, if there is a simpler method - I don't know what it is!

  • For the example given, that won't find flag P as it's too short. The other arguments such as `P:\System` appear to be parameters, which won't appear in the string table either. – MSalters Mar 5 '14 at 16:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.