Skip to main content
Applied syntax highlighting
Source Link
JW0914
  • 8.3k
  • 7
  • 31
  • 50
 

Provides the nice headings at the top with every update without needing to clear the entire console.:

$saveY = [console]::CursorTop
$saveX = [console]::CursorLeft      

while ($true) {
    Get-Process | Sort -Descending CPU | Select -First 30;
    Sleep -Seconds 2;
    [console]::setcursorposition($saveX,$saveY+3)
}
$saveY = [console]::CursorTop
$saveX = [console]::CursorLeft

while ($true) {
  Get-Process | Sort -Descending CPU | Select -First 30;
  Sleep -Seconds 2;
  [console]::setcursorposition($saveX,$saveY+3)
}

Provides the nice headings at the top with every update without needing to clear the entire console.

$saveY = [console]::CursorTop
$saveX = [console]::CursorLeft      

while ($true) {
    Get-Process | Sort -Descending CPU | Select -First 30;
    Sleep -Seconds 2;
    [console]::setcursorposition($saveX,$saveY+3)
}
 

Provides nice headings at the top with every update without needing to clear the entire console:

$saveY = [console]::CursorTop
$saveX = [console]::CursorLeft

while ($true) {
  Get-Process | Sort -Descending CPU | Select -First 30;
  Sleep -Seconds 2;
  [console]::setcursorposition($saveX,$saveY+3)
}
Source Link
Mark
  • 121
  • 1
  • 2

Provides the nice headings at the top with every update without needing to clear the entire console.

$saveY = [console]::CursorTop
$saveX = [console]::CursorLeft      

while ($true) {
    Get-Process | Sort -Descending CPU | Select -First 30;
    Sleep -Seconds 2;
    [console]::setcursorposition($saveX,$saveY+3)
}