Finding Command-Line Arguments of Programs

I know that unix has man pages, but is there a place I can look to discover command-line arguments of programs? Going to command prompt and typing notepad /? doesn't give anything.

-
If the program your curious about is FOSS, you can look at the source if they don't provide good docs. –  Zoredache Nov 5 '11 at 0:01

2 Answers

Google is probably the best method of finding command line arguments. There are certain standard arguments most programs accept when written for a particular OS. There also tends to be consistency across programs developed by a particular company. But there is very little consistency generally across all programs.

Using a web search you should be able to find the best and most accurate information regarding command line arguments for any given program. Phrasing your query like this "(program name) command line arguments" is generally the best way, though different programming conventions and different systems may use different verbiage. Experience is really the best teacher regarding other terms you should search for.

-

There are different ways, depending on your operating system:

• Linux offers man [command] and info [command]. Usually, you will be able to use [command] --help and [command] -h, too. Sometimes, just don't use any parameters ([command]) to get help output.
• In windows, you usually type [command] /? as you already noted.

Always replace [command] with your command name (so don't type any brackets).

If some software doesn't do any output, possibly

• there are no command line arguments available or
• you find them in some documentation somewhere else.

Also try to search the internet for some examples - try the command name and "bash" or "shell" for unix systems and "cmd" or "batch" for windows.

-
Do you know the command line switch to start a new notepad window with specified text in it? –  Caleb Jares Nov 4 '11 at 21:37
I wish programs would have a standardized way to view command-line arguments and documentation. Google doesn't even turn up much, the information is so scarce and uninformative. –  Caleb Jares Nov 4 '11 at 21:41
@cable729 there isn't one but you could write a script (WSH - windows scripting host), either a .vbs file or a .js file, that opens notepad and then enters keyboard keys when the notepad window is active. That would have that effect. you could then give it arguments like notepadb hello and it'd open notepad with the text "hello". –  barlop Nov 4 '11 at 21:44
If you're especially after notepad command line arguments, have a look at the unofficial notebook page. –  Jens Erat Nov 4 '11 at 21:45
@cable729 running 'notepad.exe C:\path\to\file.txt' without the quotes will open a specific file in notepad. If the path or file name have spaces in them, you will need to double quote the entire path string. –  EBGreen Nov 4 '11 at 23:03