2016-07-07 57 views
0

有没有一种方法可以将$Host.UI.RawUI.BackgroundColor设置为别名,以便我不必每次输入整个内容?为背景颜色创建别名

+1

'$别名= $ Host.UI.RawUI.BackgroundColor'? – gravity

回答

2
function bgc { param($color); $Host.UI.RawUI.BackgroundColor = $color } 

C:\PS> bgc 'Red' 

添加功能,您PSProfile

+2

对于那些想要标签填充(或ISE中的弹出列表),你可以做'功能bgc {param([System.ConsoleColor] $ color){...' – TheMadTechnician

+0

非常感谢。仅供参考,我在您的功能末尾添加了一个“Clear-Host”。 – tayopi