Where to see all options for a windows command?

I wanted to get list of file names from a folder, and I got the solution from this post How do I copy all file names in a folder to notepad?.

I would like to know where to get info of all command line switches/options available for a single windows cmd (not the whole list of commands). I tried dir -h/dir --help/dir help but nothing helps. As you get for commands in unix, it would be helpful to know.


mtk, your answer is only partly correct. HELP only works for system commands that are listed when you run HELP without an operand. There are many commands/utilities not listed in HELP for which help is available with /HELP or /? and network commands require the use of NET HELP or /HELP. The /? switch works for essentially everything that is documented, but for a very small set of network commands it only provides the parameters.

  • HELP and /? work for everything listed in HELP. Except that on my Windows 7 Home Edition system for some reason GRAFTABL has an entry in help but appears not to exist (it's there on the Enterprise Edition I use at work); all other commands that are documented in HELP have help. Contrary to what James suggests in his comment to your own answer, if HELP <command> works then <command> /? also works, the reverse, however, is not true. Additionally, two of the documented commands, DISKPART and FSUTIL require administrative privileges to even obtain the help (and DISKPART fails silently if you aren't an administrator).

  • Network commands require /HELP or /? For network commands, it gets a little complicated. To obtain help for a network commands in the NET <command> format, such as NET USE, you can enter NET HELP USE or NET USE /HELP; NET USE /? will return the syntax only. However, for other network commands, such as FINGER, IPCONFIG, and NBTSTAT, <command> /HELP and <command> /? return identical results. For still others, such as HOSTNAME, the two helps provide different information, the /? switch provides help and the /HELP switch provides some (very limited) guidance on setting hostnames (at least on my system).

  • There are many system commands for which /? works but HELP doesn't. There are some system commands that are not documented in HELP but for which you can obtain help with the help switch <command> /? (i.e. HELP <command> does not work). Normally Windows will tell you if you use HELP <command> with these commands that you should try /?. Examples are some commands that are relics from prior versions of windows such as BOOTCFG (used in Windows XP, but in Vista and Windows 7 you use BCDEDIT). There are also some commands, such as DEFRAG that are treated more as utilities, rather than commands, in the documentation, that have help available but again only with /?. WINSAT is an example of a command that requires /? for help but fails silently if not run as an administrator. Apparently wherever HELP <command> doesn't work <command> /HELP is possible as an alternative, just like with network commands (for example DEFRAG /HELP works).

One oddball, SC responds to all of HELP SC, SC /HELP, and SC /? providing the same help but in all three cases the help begins with an error.

You can find a rather comprehensive list of commands here, though a lot depends on how you define a command. Any .EXE could be treated as a command and you'll notice the compendium at the link includes traditional "commands", "command line utilities", system tools, and invocations for programs such as PowerShell and PowerShell_ISE. Note, command line help doesn't work for some programs that open in the GUI environment, such as PowerShell_ISE (which is why my fourth sentence, above, says "essentially"). Online help suggests it should work but it doesn't (the ISE actually misinterprets /? as an operand and tries to load the file /?. Also, note, although the descriptions at the link are frequently better than in help, the OSs to which they apply are not always accurate (e.g. PowerShell_ISE says it applies only to Windows 8 and Windows Server 2012; however, PowerShell_ISE is available in Windows 7.

The bottom line is that generally /? will get you help if there is any. For a few network commands, namely those that start with NET <command>, you should use /HELP for more detail.


Got it, typing help gives all available commands, and typing help <cmd-name> give all options.

e.g.

> help
For more information on a specific command, type HELP command-name
ASSOC          Displays or modifies file extension associations.
ATTRIB         Displays or changes file attributes.
BREAK          Sets or clear
....

and

> help dir
Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

  [drive:][path][filename]
              Specifies drive, directory, and/or files to list.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
               H  Hidden files               A  Files ready for archiving
               S  System files               I  Not content indexed files
               L  Reparse Points             -  Prefix meaning not
  /B          Uses bare format (no heading information or summary).
  /C          Display the thousand separator in file sizes.  This is the
              default.  Use /-C to disable display of separator.
  /D          Same as wide but files are list sorted by column.