使用参数-online 为`man` 创建别名? [英] Creating Alias to `man` with arguments -online?
本文介绍了使用参数-online 为`man` 创建别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为 Get-Help [foo] -online
创建别名.但我无法让参数起作用.
I want to create an alias for Get-Help [foo] -online
. But I can't get arguments to work.
我尝试了一些东西,包括 Set-Alias -Name mano -Value "Get-Help -online"
I tried a few things including Set-Alias -Name mano -Value "Get-Help -online"
PS C:\Program Files\ConEmu> mano Get-Content
Cannot resolve alias 'mano' because it refers to term 'Get-Help -online',
which is not recognized as a cmdlet, function, operable program, or script
file. Verify the term and try again.
At line:1 char:5
+ mano <<<< Get-Content
+ CategoryInfo : ObjectNotFound: (mano:String) [], CommandNo
tFoundException
+ FullyQualifiedErrorId : AliasNotResolvedException
推荐答案
你不能用这样的参数创建别名.
You can't create an alias with arguments like that.
你可以使用一个函数.像……
You can use a function though. Something like...
PS> function mano { Get-Help $args[0] -online }
如果您希望每次启动 ps 时都可以使用它,那么您可以将其放入您的个人资料中.见$profile
.
If you want this to be available every time you start ps, then you can put it in your profile. see $profile
.
这篇关于使用参数-online 为`man` 创建别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文