2016-07-07 52 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