क्या विंडोज में cmd ​​कमांड की एक सूची प्राप्त करने के लिए एक कमांड है?


16

विंडोज ऑफ़लाइन (इंटरनेट कनेक्शन के बिना) चलाने वाले कंप्यूटर पर काम करते समय, क्या कमांड-लाइन के माध्यम से उपलब्ध सीएमडी कमांड (उपयोग सहित) की सूची प्राप्त करना / उत्पन्न करना संभव है ?

जवाबों:


20

आदेशों की सूची के लिए:

help

और एक विशिष्ट आदेश के बारे में जानकारी के लिए:

help <command>

या

<command> /?

उदाहरण के लिए:

help xcopy
xcopy /?

आप xcopy /?कमांड के बारे में जानकारी प्राप्त करने के लिए उपयोग कर सकते हैं । :)
11

यह भी तरह नेटवर्किंग आदेशों की एक सूची प्राप्त करना संभव है ping, arp, nslookup? ऐसा लगता है कि helpकेवल मूल विंडोज कमांड की सूची तैयार करता है न कि नेटवर्किंग कमांड।
amiregelz

2
@amiregelz: वे windows\system32फ़ोल्डर में प्रोग्राम हैं जो मुझे विश्वास है कि प्रोग्राम / कमांड को हल करते समय यह दिखता है। अपनी सूची के लिए आप वहां से बाहर निकल सकते हैं। देखें ओलिवर का जवाब।
जॉर्ज डकेट

14

आप Microsoft आदेश-पंक्ति संदर्भ AZ में एक आधिकारिक सूची पा सकते हैं । इसके अलावा...

सीधे आपके प्रश्न का उत्तर देने के लिए, मैंने एक स्क्रिप्ट तैयार की, जो उन सभी .exeफाइलों को सूचीबद्ध करती है जिन्हें आप निष्पादित कर सकते हैं (क्योंकि वे आपके स्थान पर स्थित हैं PATH)। डिफ़ॉल्ट रूप से, यह केवल उन लोगों को सूचीबद्ध करता है जो %WINDIR%तब तक रहते हैं (जब तक कि आप इसे साथ नहीं चलाते --all)।

स्क्रिप्ट की पिछली पुनरावृत्ति में, मैंने हर कमांड के साथ शुरुआत की /?, जो एक बहुत बुरा विचार है। हर एप्लिकेशन PATHउस पैरामीटर को नहीं समझता है। कुछ बस शुरू हो जाएगा और किसी भी मदद को मुद्रित करने के बजाय, चालू रहेगा। ताकि जल्दी से बहुत सारे संसाधनों को खा जाए।

@SETLOCAL ENABLEEXTENSIONS 
@ECHO OFF

IF "%1"=="--all" (
    SET LIST_ALL=TRUE
)
CALL :printPath "%PATH%"
:printPath
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 (
                ECHO.%%~dnpfF
            )
        )
        POPD
    ) ELSE (
        REM ECHO Skipping non-existent folder '%%A'
    )
    CALL :printPath "%%~B"
)
ENDLOCAL

इसलिए वहाँ। यह आपको सभी उपलब्ध कमांड और उनके मापदंडों की एक सूची देता है। जैसा कि आप पहले से ही उम्मीद कर सकते हैं, यह उतना उपयोगी नहीं है जितना कोई कल्पना कर सकता है।

यहाँ क्या वास्तव में महत्वपूर्ण है!

.exeआपके PATHद्वारा cmd.exeबनाई गई फ़ाइलों की तुलना में अधिक दिलचस्प बिल्ट-इन हैं। जैसे IF, FORऔर SET। मेरे पास बिल्ट-इन की पूरी सूची नहीं है, लेकिन आप उनमें से अधिकांश को चलाकर देख सकते हैं cmd.exe /?:

DEL or ERASE
COLOR
CD or CHDIR
MD or MKDIR
PROMPT
PUSHD
POPD
SET
SETLOCAL
ENDLOCAL
IF
FOR
CALL
SHIFT
GOTO
START (also includes changes to external command invocation)
ASSOC
FTYPE

हालाँकि, उस समय मदद कमांड एक्सटेंशन को संदर्भित कर रही है , इसलिए सूची अधूरी हो सकती है। आइए, कुछ बिल्ट-इन पर एक नज़र डालें:

के लिये /?

FORकमांड के लिए प्रलेखन उन सभी पागल मापदंडों को सूचीबद्ध करता है जिन्हें आप पास कर सकते हैं FOR। यदि आप लूप से संबंधित कुछ भी लिखना चाहते हैं तो यह गो-टू यूटिलिटी है ।

इस दस्तावेज़ में पागल "टिल्ड नोटेशन" के लिए स्पष्टीकरण भी शामिल है:

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 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 आपको चर पर कई प्रकार के ऑपरेशन करने की अनुमति देता है।

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

यह उपर्युक्त "टिल्ड नोटेशन" के माध्यम से स्ट्रिंग हेरफेर की भी अनुमति देता है


क्या आपको लगता है कि यहाँ कमांड करने का एक तरीका है जो यहाँ सूचीबद्ध है लेकिन टाइप करते समय नहीं help? उदाहरण के लिए नेटवर्क आदेशों की तरह ipconfig, nslookup, arp, telnetऔर ping?
amiregelz

@amiregelz: ठीक काम करना चाहिए क्योंकि वे में स्थित हैं C:\Windows\System32। मुझे लगता है कि पर हैPATH
डेर Hochstapler

यह उन्हें सूचीबद्ध नहीं करता है, भले ही वे वहां स्थित हों। यह ARP.EXEहालांकि सूचीबद्ध करता है। जब आप अपनी स्क्रिप्ट निष्पादित करते हैं, तो क्या आप मेरे द्वारा बताई गई कमांड देखते हैं?
amiregelz

@amiregelz: हाँ, लेकिन मुझे लगता है कि अगर आपके PATHफ़ोल्डर में ऐसा कोई समस्या है जो अब मौजूद नहीं है। जो स्क्रिप्ट को तोड़ने का कारण बनता है। शायद यह मुद्दा है? मैं एक फिक्स पर काम कर रहा हूँ।
डेर होकस्टापलर

2
@amiregelz: इसके अलावा ऐसा लगता है कि आपके लिए हर एप्लिकेशन को शुरू करना समझदारी नहीं है PATH: D
Der Hochstapler

6

वहाँ dostips.com पर बैच स्क्रिप्ट उपलब्ध है ( CreateDosCommandIndex.bat ) जो सिस्टम पर उपलब्ध डॉस कमांड की पूरी सूची के साथ-साथ "कमांडनाम /?"

मैं इसे नीचे बता रहा हूं क्योंकि dostips.com को इस समय db लोड से संबंधित समस्याएं हैं और उनकी वेबसाइट रुक-रुक कर काम करती है।

@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS

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'>"
            "<head>"
            "<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;}"
            "</style>"
            "<title>%title%</title>"
            "<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />"
            "</head>"
            "<body bgcolor='#FFFFCC'>"
            "<font color='darkblue'>"
            "<h1>%title%</h1>"
            "<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>"
            "</table>"
            "</div>"
            "<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 (
            "</table>"
            "<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 (
            "</pre></div>"
            ) do echo.%%~A>>"%z%"
    call:tickProgress
)

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>"
            "<div class='sourcebatch'><pre><xmp>"
            ) do echo.%%~A>>"%z%"
type "%~f0" >>"%z%"

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


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

:SKIP
REM.-- End of application
FOR /l %%a in (5,-1,1) do (TITLE %title% -- closing in %%as&ping -n 2 -w 1 127.0.0.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
GOTO:EOF


:tickProgress -- display the next progress tick
set /a "ProgressCnt+=1"
SETLOCAL
set /a "per=100*ProgressCnt/ProgressMax"
set "per=%per%%%"
call title %%ProgressFormat:[P]=%per%%%
GOTO:EOF

1
बहुत अच्छा दृष्टिकोण। Processing SCहालांकि यह मेरे लिए बंद हो जाता है । लेकिन ऐसा लगता है कि यह केवल कुछ इनपुट की प्रतीक्षा कर रहा है। तो Enterइसे खत्म होने दें
दबाएं

1
यह बहुत अच्छा (प्रसंस्करण और html फ़ाइल पैदा करने), हालांकि यह है कि स्क्रिप्ट पहले से करने का आग्रह कर, जबकि यह केवल आदेशों से पता चलता helpआदेश से पता चलता है (जो आसान है निष्पादित करने के लिए)। फिर भी, इनपुट के लिए धन्यवाद, यह बहुत उपयोगी है। @ ऑलिवर साल्ज़बर्ग यह मेरे लिए वहाँ भी रूक जाता है।
amiregelz

3

यह बिल्कुल वैसा नहीं है जैसा आप एक ऑफ़लाइन समाधान के लिए देख रहे हैं (आपको वेबपृष्ठ को खोलने के लिए इंटरनेट कनेक्शन की आवश्यकता है), लेकिन cmd कमांड के लिए एक बहुत ही उपयोगी उपकरण और संदर्भ है:

Windows CMD कमांड लाइन का एक AZ इंडेक्स।


यह उपयोगी है, लेकिन यह वह नहीं है जिसकी मुझे तलाश है। फिर भी धन्यवाद।
13

@amiregelz यह एक ऑफ़लाइन समाधान है यदि आप इसे उदाहरण के लिए wget के साथ डाउनलोड करते हैं।
बार्लोप

3

मुझे पता है कि यह बिल्कुल वैसा नहीं है जैसा आप पूछ रहे हैं, बल्कि आप कमांड प्रॉम्प्ट के बजाय पॉवरशेल सीखना शुरू कर सकते हैं। Microsoft Powershell के लिए कमांड प्रॉम्प्ट को चरणबद्ध करने की कोशिश कर रहा है ताकि यह सीखने के लिए एक अच्छा कौशल हो।

यदि आप पॉवर्सशेल में हैं तो कमांड Get-Commandउन सभी कमांड को सूचीबद्ध करेगा जो वर्तमान में सभी लोड किए गए मॉड्यूल से चलाए जा सकते हैं। यह एक आउटपुट का उत्पादन करेगा जो इस तरह दिखता है:

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...
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.