Help (HELP and /?)
If you ever wonder “what options does this command have?”, you don’t need to search the web. Command Prompt can tell you by itself.
This article explains how to use the HELP command and the /? option, and how to read the syntax they display.
Listing available commands
Running help with no arguments displays a list of the main commands that have help available.
help
Commands such as ping and ipconfig do not appear in the help list. You can look them up with the /? option described below.
Showing help for a specific command
HELP command-name
Specify a command name after help to see detailed usage for that command.
help command-name

中小企業経営者のためのRPA入門 RPA導入を成功させる方法

60分でわかる! AIエージェント 超入門

コマンドラインの黒い画面が怖いんです。

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門
command-name /?
Adding /? after a command name also displays its help.
command-name /?
help dir and dir /? show almost the same content.
| Method | Characteristics |
|---|---|
help command-name | Works only for commands in the help list |
command-name /? | Also works for external commands (ping, ipconfig, etc.) |
Many commands support /?, including ones missing from the help list. Try /? first.
Some commands use -? or --help instead of /?. For example, tar and curl show help with --help. If /? does not work, try these as well.
Reading the syntax
The syntax shown in help uses its own notation. For example, near the top of dir /? you will see a line like this:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
The main notation rules are:
| Notation | Meaning |
|---|---|
[ ] | Optional item |
No [ ] | Required item |
A | B | Specify either A or B |
... | The item can be repeated |
Because every item of dir is enclosed in [ ], you can run it without specifying anything.
Making long help easier to read
For commands with long help, such as for /? or set /?, the top of the text scrolls off the screen. These techniques make it easier to read.
Show one screen at a time
Pass the output to the more command with a pipe. Press the space bar for the next screen and q to quit.
for /? | more
Save to a file
Use redirection to save the help text to a file.
for /? > for-help.txt
You can then open the file in Notepad and read it at your own pace.
Search for only the part you need
Combine it with the findstr command to find only the lines containing a particular string. /C: is needed because otherwise /B would be parsed as an option of findstr itself.
dir /? | findstr /C:"/B"
Differences from PowerShell
In PowerShell, help is a function that wraps Get-Help (with paging), so its output differs from Command Prompt. Typing dir /? in PowerShell also does not show the Command Prompt help.
To see Command Prompt help, run the command in Command Prompt, or from PowerShell with something like cmd /c dir /?.
Summary
- Running
helpalone lists the commands that have help available help command-nameorcommand-name /?shows how a command works/?also works for external commands, so try it first- In the syntax,
[ ]means optional and|means a choice - Use
| moreor> filenameto make long help easier to read