Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Digital Archaeology » Top-like command for Windows
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Top-like command for Windows [message #288649] Wed, 29 April 2015 09:24
CyberkNight is currently offline  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.


  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Flash Motherboard BIOS on Linux PC With No Floppy
Next Topic: Keeping a process alive after terminal is closed (Linux)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Apr 23 09:38:14 EDT 2024

Total time taken to generate the page: 0.06304 seconds