[英]How to run multiple commands in a PowerShell Alias
I'm trying to add an alias to PowerShell in my $profile
file. 我正在尝试在我的$profile
文件中为PowerShell添加别名。
Set-Alias regrunt grunt;g aa;g cm 'regrunted';g ps;
When I run regrunt
, only the first command is run. 当我运行regrunt
,只运行第一个命令。 How can I make this alias run all of the commands? 如何让这个别名运行所有命令?
PS: Please no comments about "do not commit minified files", we have all passed through this. PS:请不要评论“不要提交缩小文件”,我们都通过了这个。
You can't unfortunately. 你不能不幸。 Aliases in PowerShell can only be for a single command. PowerShell中的别名只能用于单个命令。
You will need to define a function to run multiple commands: 您需要定义一个函数来运行多个命令:
function regrunt {
grunt;g aa;g cm 'regrunted';g ps;
}
Aliases in PowerShell are designed for a simple renaming of commands. PowerShell中的别名专为命令的简单重命名而设计。 Only one command, no parameters. 只有一个命令,没有参数。 To do what you want, write a function. 要做你想做的事,写一个函数。
function regrunt {
grunt
g aa
g cm 'regrunted'
g ps
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.