Home »
Digital Archaeology »
Digital Archaeology »
Top-like command for Windows
Top-like command for Windows [message #288649] |
Wed, 29 April 2015 09:24 |
CyberkNight
Messages: 1606 Registered: July 2012
Karma: 0
|
Senior Member |
|
|
Windows does not come with a command-line top-like command but one can easily be created using Windows PowerShell:
$saveY = [console]::CursorTop
$saveX = [console]::CursorLeft
while ($true) {
Get-Process | Sort -Descending CPU | Select -First 30;
Sleep -Seconds 2;
[console]::setcursorposition($saveX,$saveY+3)
}
The "saveY" and "saveX" variables are used to reposition the cursor so that the screen does not have to be cleared each time (which would create an annoying blinking affect between refreshes).
Just save the above script in a file called top.ps1 and run by typing PowerShell.exe c:\<path>\top.ps1
See http://superuser.com/questions/176624/linux-top-command-for- windows-powershell for more info and other examples.
Megalextoria
|
|
|
Goto Forum:
Current Time: Tue Apr 23 09:38:14 EDT 2024
Total time taken to generate the page: 0.06304 seconds