0

What command would I use in CMD to get all of a program's available switches/arguments? For example, program abc.exe might have a switch of /o that starts the program in offline mode. Assuming I did not know about the /o switch, what would I need to do in Command Prompt to get this information?

Edit:

I would like to also add that I know how I can find the switches and arguments that are already being used in a running program - this is not what I am after. I want to obtain ALL available command line arguments for a program, whether it's running or not.

  • 3
    Try calling the EXE in the CMD window followed by /? or -help or --help just as you explain how you use /o. Its really a matter of each EXE/program actually being coded to bring back the help screen with the detail.If you want to see the Windows built in commands, then just type HELP and press enter and for those commands type in <command> /? – Pimp Juice IT Jul 13 '16 at 20:12
  • 2
  • Googling "program_name command line arguments" usually helps if the program doesn't have built in command line help. – DavidPostill Jul 13 '16 at 20:20
1

Except for already mentioned /?, --help, reading documentation and googling there is no standard way to do it. Unfortunately, some programs don't document their switches well - there is (almost) nothing that can be done with those.

This is why: each program analyzes its command line completely differently, and even having switches is just an agreement that most authors tend to follow: some have /dos style switches, some are -uNIX style, some use --gnu-long-style=switches, and some just don't understand any, taking the first thing they see as a file name.

So, parameter analyzis is a part of program code, and so to know what parameters the program actually accepts you would need to read its source code, which you normally do not even have.

The only other option is to disassemble the program in question. Disassembly is basicly taking a program apart, instruction by instruction, trying to figure what it tries to do and how. It takes a lot of time and is quite a hard to learn.

Sometimes you can get away with opening your program in a hex editor and searching for a command you know, often somewhere near the end, and then trying anything nearby that looks like a switch.

0

Most programs will accept the /? or -? switch to allow you to see what parameters the command will accept. Some GNU or *nix-based utilities (in layman's terms, a program mostly intended for Linux users, but also available for other platforms) require you to add --help for it to give you brief documentation.

When all fails, of course, you can just use documentation.

To find the switches used for a running program, you can use Process Explorer or Process Hacker, or even the command line as explained in a related question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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