Skip to content

Latest commit

 

History

History
79 lines (58 loc) · 3.33 KB

File metadata and controls

79 lines (58 loc) · 3.33 KB

Get-Command VS Get-Help

都可以查詢命令。

Get-Help 是從手冊中查詢,會提供完整的內容。如果你想要查詢的命令是本地端裝設的應用程式,請用 Get-Command Get-Help 會認不出來。

以下是兩個命令查詢 ls 的區別:

  • Get-Command ls
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           ls -> Get-ChildItem
  • Get-Help ls
NAME
    Get-ChildItem

SYNTAX
    Get-ChildItem [[-Path] <string[]>] [[-Filter] <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [-Depth <uint32>] [-Force]
    [-Name] [-UseTransaction] [-Attributes {ReadOnly | Hidden | System | Directory | Archive | Device | Normal | Temporary | SparseFile |
    ReparsePoint | Compressed | Offline | NotContentIndexed | Encrypted | IntegrityStream | NoScrubData}] [-Directory] [-File] [-Hidden]
    [-ReadOnly] [-System]  [<CommonParameters>]

    Get-ChildItem [[-Filter] <string>] -LiteralPath <string[]> [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [-Depth <uint32>]
    [-Force] [-Name] [-UseTransaction] [-Attributes {ReadOnly | Hidden | System | Directory | Archive | Device | Normal | Temporary |
    SparseFile | ReparsePoint | Compressed | Offline | NotContentIndexed | Encrypted | IntegrityStream | NoScrubData}] [-Directory] [-File]
    [-Hidden] [-ReadOnly] [-System]  [<CommonParameters>]                                                                  

ALIASES
    gci
    ls
    dir

REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Get-ChildItem -Online" or
           go to https://go.microsoft.com/fwlink/?LinkID=113308.

以下是兩個命令查詢 git 的區別:

  • Get-Command git
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     git.exe                                            2.30.2.1   C:\Program Files\Git\cmd\git.exe
  • Get-Help git
Get-Help : Get-Help could not find git in a help file in this session. To download updated help topics type: "Update-Help". To get help
online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At line:1 char:1
+ Get-Help git
+ ~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

參考資料