When working on a computer running Windows offline (without an Internet connection), is it possible to get/generate a list of available cmd commands (including usage) through command-line?


5 Answers 5


For a list of commands:


And for details about a specific command:

help <command>


<command> /?

For example:

help xcopy
xcopy /?
  • You can use xcopy /? to get the information about the command. :)
    – avirk
    Commented Nov 21, 2012 at 11:59
  • Is it possible to also get a list of networking commands like ping, arp, nslookup? It seems that help only generates a list of basic Windows commands and not networking commands.
    – amiregelz
    Commented Nov 21, 2012 at 12:21
  • 2
    @amiregelz: Those are programs in the windows\system32 folder which i believe it looks in when resolving programs/commands. For your list you could look for exes there. See Oliver's answer. Commented Nov 21, 2012 at 14:01

You can find an official list at Microsoft Command-line reference A-Z. Besides that...

To answer your question directly, I devised a script that simply lists all .exe files that you can execute (because they're located on your PATH). By default, it only lists those that also reside in %WINDIR% (unless you run it with --all).

In a previous iteration of the script, I started every command with /?, which is a very bad idea. Not every application on the PATH understands that parameter. Some will simply start and remain running, instead of printing any help. So that eats up a lot of resources rather quickly.


IF "%1"=="--all" (
CALL :printPath "%PATH%"
FOR /F "tokens=1,* delims=;" %%A IN ("%~1") DO (
    IF EXIST "%%A" (
        PUSHD "%%A"
        FOR %%F IN (*.exe) DO (
            ECHO.%%~dnpfF | FINDSTR /C:"%WINDIR%" 1> NUL
            IF ERRORLEVEL 1 (
                IF "%LIST_ALL%"=="TRUE" ECHO.%%~dnpfF
            ) ELSE (
    ) ELSE (
        REM ECHO Skipping non-existent folder '%%A'
    CALL :printPath "%%~B"

So, there. This gives you a list of all available commands and their parameters. As you can already expect, it's not as useful as one might imagine.

Here's what's really important!

More interesting than the .exe files on your PATH are the cmd.exe built-ins. Like IF, FOR and SET. I don't have a complete list of the built-ins, but you can see most of them by running cmd.exe /?:

START (also includes changes to external command invocation)

Though, at that point the help is referencing command extensions, so the list may be incomplete. Let's take a closer look at some built-ins:

FOR /?

The documentation for the FOR command lists all the crazy parameters you can pass to FOR. This is the go-to utility if you want to write anything related to loops.

This documentation also contains the explanation for the crazy "tilde notation":

In addition, substitution of FOR variable references has been enhanced
You can now use the following optional syntax:

    %~I         - expands %I removing any surrounding quotes (")
    %~fI        - expands %I to a fully qualified path name
    %~dI        - expands %I to a drive letter only
    %~pI        - expands %I to a path only
    %~nI        - expands %I to a file name only
    %~xI        - expands %I to a file extension only
    %~sI        - expanded path contains short names only
    %~aI        - expands %I to file attributes of file
    %~tI        - expands %I to date/time of file
    %~zI        - expands %I to size of file
    %~$PATH:I   - searches the directories listed in the PATH
                   environment variable and expands %I to the
                   fully qualified name of the first one found.
                   If the environment variable name is not
                   defined or the file is not found by the
                   search, then this modifier expands to the
                   empty string

The modifiers can be combined to get compound results:

    %~dpI       - expands %I to a drive letter and path only
    %~nxI       - expands %I to a file name and extension only
    %~fsI       - expands %I to a full path name with short names only
    %~dp$PATH:I - searches the directories listed in the PATH
                   environment variable for %I and expands to the
                   drive letter and path of the first one found.
    %~ftzaI     - expands %I to a DIR like output line

IF /?

IF is the command for branching. You'll need this page because it lists the comparison operators:

If Command Extensions are enabled IF changes as follows:

    IF [/I] string1 compare-op string2 command
    IF CMDEXTVERSION number command
    IF DEFINED variable command

where compare-op may be one of:

    EQU - equal
    NEQ - not equal
    LSS - less than
    LEQ - less than or equal
    GTR - greater than
    GEQ - greater than or equal

SET /?

SET allows you to perform a wide variety of operations on variables.

The /A switch specifies that the string to the right of the equal sign
is a numerical expression that is evaluated.  The expression evaluator
is pretty simple and supports the following operations, in decreasing
order of precedence:

    ()                  - grouping
    ! ~ -               - unary operators
    * / %               - arithmetic operators
    + -                 - arithmetic operators
    << >>               - logical shift
    &                   - bitwise and
    ^                   - bitwise exclusive or
    |                   - bitwise or
    = *= /= %= += -=    - assignment
      &= ^= |= <<= >>=
    ,                   - expression separator

It also allows for string manipulation through the above mentioned "tilde notation"

  • Do you think there's a way to get commands that are listed here but not when typing help? E.g network commands like ipconfig, nslookup, arp, telnet and ping?
    – amiregelz
    Commented Nov 21, 2012 at 12:44
  • @amiregelz: Should work fine as they are located in C:\Windows\System32. I assume that's on the PATH Commented Nov 21, 2012 at 13:36
  • It doesn't list them even though they are located there. It lists the ARP.EXE though. Do you see the commands I mentioned when you execute your script?
    – amiregelz
    Commented Nov 21, 2012 at 16:24
  • @amiregelz: Yes, but I think there's a problem if your PATH contains a folder that no longer exists. That causes the script to break. Maybe that's the issue? I'm working on a fix. Commented Nov 21, 2012 at 17:57
  • 2
    @amiregelz: Also it seems like it's not that wise to start every application on your PATH :D Commented Nov 21, 2012 at 18:01

There's batch script available at dostips.com (CreateDosCommandIndex.bat) which generates an html file containing the complete list of available dos commands on the system, along with their respective output generated through "commandname /?"

I'm reporting it below since dostips.com seems to have db load related problems at this time and their website works intermittently.

REM.-- Prepare the Command Processor

REM --
REM -- Copyright note
REM -- This script is provided as is.  No waranty is made, whatso ever.
REM -- You may use and modify the script as you like, but keep the version history with
REM -- recognition to http://www.dostips.com in it.
REM --

REM Version History:
REM         XX.XXX      YYYYMMDD Author Description
SET "version=01.000"  &:20051201 p.h.   initial version, origin http://www.dostips.com
SET "version=01.001"  &:20060122 p.h.   Fix missing exclamation marks in documentation (http://www.dostips.com)
SET "version=01.002"  &:20060218 p.h.   replaced TEXTAREA with PRE XMP (http://www.dostips.com)
SET "version=01.003"  &:20060218 p.h.   php embedding (http://www.dostips.com)
SET "version=01.004"  &:20060723 p.h.   fix page links for FireFox (http://www.dostips.com)
SET "version=01.005"  &:20061015 p.h.   invoke HELP via '"call" help', allows overriding help command with a help.bat file (http://www.dostips.com)
SET "version=01.006"  &:20061015 p.h.   cleanup progress indicator (http://www.dostips.com)
SET "version=01.007"  &:20080316 p.h.   use codepage 1252 to support european users (http://www.dostips.com)
SET "version=02.000"  &:20080316 p.h.   use FOR command to generate HTML, avoids most escape characters (http://www.dostips.com)
SET "version=02.000"  &:20100201 p.h.   now using css and xhtml
REM !! For a new version entry, copy the last entry down and modify Date, Author and Description
SET "version=%version: =%"

for /f "delims=: tokens=2" %%a in ('chcp') do set "restore_codepage=%%a"
chcp 1252>NUL

set "z=%~dpn0.htm"

rem echo.^<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"^> >"%z%"
echo.^<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"^> >"%z%"

set "title=DOS Command Index"
for /f "tokens=*" %%a in ('ver') do set "winver=%%a"

echo.Creating the header ...
for %%A in (
            "<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>"
            "<style type='text/css'>"
            "  h1              {text-align:center;}"
            "  h2              {text-align:center;}"
            "  table.center    {margin-left: auto;margin-right: auto;}"
            "  td              {text-align:left;}"
            "  div.center      {text-align:center;}"
            "  div.sourcebatch {background: #DDDDDD;}"
            "  div.helptext    {background: #F8F8FF;}"
            "  div.top         {float: right;}"
            "<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />"
            "<body bgcolor='#FFFFCC'>"
            "<font color='darkblue'>"
            "<div class='center'>"
            "<table class='center' border='1' cellspacing='1' cellpadding='3'>"
            "    <tr><td>Windows Version</td><td>:</td><td>%winver%</td></tr>"
            "    <tr><td>Document Source</td><td>:</td><td>"
            "        <a href='http://www.dostips.com/'><b>http://www.dostips.com</a><br />"
            "        <a href='http://www.dostips.com/%~n0.php'><b>http://www.dostips.com/%~nx0.php</a>"
            "        </td></tr>"
            "    <tr><td>Created by</td><td>:</td><td><a href='http://www.dostips.com/%~nx0'>"
            "        <b>%~nx0</b></a><br /><a href='#%~n0'><b>Source Code below</b></a></td></tr>"
            "<br /><br />"
            "<table class='center'>"
            ) do echo.%%~A>>"%z%"

echo.Creating the index ...
set /a cnt=0
for /f "tokens=1,*" %%a in ('"help|findstr /v /b /c:" " /c:"For more""') do (
    for %%A in (
            "    <tr><td><a href='#%%a'>%%a</a></td><td>%%b</td></tr>"
            ) do echo.%%~A>>"%z%"
    set /a cnt+=1
for %%A in (
            "<br /><br />"
            ) do echo.%%~A>>"%z%"

echo.Extracting HELP text ...
call:initProgress cnt
for /f %%a in ('"help|findstr /v /b /c:" " /c:"For more""') do (
    echo.Processing %%a
    for %%A in (
            "<div class='top'><a href='#'>TOP</a></div>"
            "<h2><a name='%%a'>%%a</a></h2>"
            "<div class='helptext'><pre><xmp>"
            ) do echo.%%~A>>"%z%"
    call help %%a >>"%z%" 2>&1
    echo ^</xmp^> >>"%z%"
    for %%A in (
            ) do echo.%%~A>>"%z%"

echo.Injecting source script ...
for %%A in (
            "<br /><br />"
            "<div class='center'>"
            "<div class='top'><a href='#'>TOP</a></div>"
            "<a name='%~n0'><h2>DOS Batch Script Source that created this Document</h2></a>"
            "This %title% has been created automatically by the following DOS batch script:"
            "<br /><br />"
            "<div class='sourcebatch'><pre><xmp>"
            ) do echo.%%~A>>"%z%"
type "%~f0" >>"%z%"

echo.Creating the footer ...
echo ^</xmp^> >>"%z%"
for %%A in (
            ) do echo.%%~A>>"%z%"

chcp %restore_codepage%>NUL
explorer "%z%"

REM.-- End of application
FOR /l %%a in (5,-1,1) do (TITLE %title% -- closing in %%as&ping -n 2 -w 1>NUL)
TITLE Press any key to close the application&ECHO.&GOTO:EOF

::helper functions follow below here

:initProgress -- initialize an internal progress counter and display the progress in percent
::            -- %~1: in  - progress counter maximum, equal to 100 percent
::            -- %~2: in  - title string formatter, default is '[P] completed.'
set /a "ProgressCnt=-1"
set /a "ProgressMax=%~1"

set "ProgressFormat=%~2"
if "%ProgressFormat%"=="" set "ProgressFormat=[PPPP]"
set "ProgressFormat=%ProgressFormat:[PPPP]=[P] completed.%"
call :tickProgress

:tickProgress -- display the next progress tick
set /a "ProgressCnt+=1"
set /a "per=100*ProgressCnt/ProgressMax"
set "per=%per%%%"
call title %%ProgressFormat:[P]=%per%%%
  • 1
    Very nice approach. It stops on Processing SC for me though. But it seems like it's only waiting for some input. So pressing Enter let it finish :) Commented Nov 26, 2012 at 22:36
  • 1
    It's pretty cool (processing & generating the html file), though it does require you to have that script beforehand, while it only shows the commands that the help command shows (which is easier to execute). Still, thanks for the input, it's very useful. @OliverSalzburg It stops there for me as well.
    – amiregelz
    Commented Nov 26, 2012 at 23:00

It is not exactly what you are looking for a offline solution (you need you internet connection to open the webpage), but is a very useful tool and reference for cmd commands:

An A-Z Index of the Windows CMD command line.

  • It's useful, but it's not what I'm looking for. Thanks anyway.
    – amiregelz
    Commented Nov 21, 2012 at 13:03
  • @amiregelz it is an offline solution if you download it e.g. with wget.
    – barlop
    Commented Nov 16, 2013 at 16:41

I know it is not exactly what you are asking for, but you may want to start learning Powershell instead of the command prompt. Microsoft is trying to phase out the command prompt for Powershell so it would be a good skill to learn.

If you are in Powershell the command Get-Command will list all commands that can currently be run from all loaded modules. It will produce a output that looks like this:

CommandType     Name                            Definition
-----------     ----                            ----------
Cmdlet          Add-Content                     Add-Content [-Path] <String[...
Cmdlet          Add-History                     Add-History [[-InputObject] ...
Cmdlet          Add-Member                      Add-Member [-MemberType] <PS...
Cmdlet          Add-PSSnapin                    Add-PSSnapin [-Name] <String...
Cmdlet          Clear-Content                   Clear-Content [-Path] <Strin...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .