要获取有关Windows命令提示符cmd.exe
中的命令的帮助,我可以这样做:
rmdir /?
xcopy /?
etc.
如何在PowerShell中做到这一点?
答案 0 :(得分:3)
答案是Get-Help
。
它显示Syntax
,Aliases
,Examples
等。
示例:
Get-Help rmdir
NAME
Remove-Item
SYNTAX
Remove-Item [-Path] <string[]> [-Filter <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [-Force]
[-Credential <pscredential>] [-WhatIf] [-Confirm] [-UseTransaction] [-Stream <string[]>] [<CommonParameters>]
Remove-Item -LiteralPath <string[]> [-Filter <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse]
[-Force] [-Credential <pscredential>] [-WhatIf] [-Confirm] [-UseTransaction] [-Stream <string[]>]
[<CommonParameters>]
ALIASES
ri
rm
rmdir
del
erase
rd
有关更多信息,请使用-Full
或-Detailed
参数:
Get-Help <command> -Detailed
:
NAME
Remove-Item
SYNTAX
Remove-Item [-Path] <string[]> [-Filter <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse]
[-Credential <pscredential>] [-WhatIf] [-Confirm] [-UseTransaction] [-Stream <string[]>] [<CommonParamet
Remove-Item -LiteralPath <string[]> [-Filter <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recu
[-Force] [-Credential <pscredential>] [-WhatIf] [-Confirm] [-UseTransaction] [-Stream <string[]>]
[<CommonParameters>]
PARAMETERS
-Confirm
-Credential <pscredential>
-Exclude <string[]>
-Filter <string>
-Force
-Include <string[]>
-LiteralPath <string[]>
-Path <string[]>
-Recurse
-Stream <string[]>
-UseTransaction
-WhatIf
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
ALIASES
ri
rm
rmdir
del
erase
rd
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 Remove-Item -Online" or
go to http://go.microsoft.com/fwlink/?LinkID=113373.
xcopy
和robocopy
之类的命令本身是可执行的,通常没有Powershell-Help-File。
要获取有关它们的信息,可以尝试/?
或--?
。
答案 1 :(得分:2)
Get-Help [command]
是在PowerShell中获取命令文档的通用方法。