Powershell 【控制台常用方法】


 1 function Pause(){
 2     [System.Console]::Write('按任意键继续...')
 3     [void][System.Console]::ReadKey(1)
 4 }
 5 [System.Console]::Title='控制台常用方法'
 6 0..15|ForEach-Object{
 7     [System.Console]::SetCursorPosition($_,$_)
 8     [System.Console]::BackgroundColor=15-$_
 9     [System.Console]::ForegroundColor=$_
10     $_
11     [System.Console]::SetCursorPosition(15+$_,15-$_)
12     [System.Console]::BackgroundColor=$_
13     [System.Console]::ForegroundColor=15-$_
14     15-$_
15 }
16 [System.Console]::ResetColor()
17 [System.Console]::SetWindowSize(80,30)
18 [System.Console]::SetCursorPosition(0,16)
19 pause