List Current Processes

By KuTsuM on Sep 26, 2007

This snippet will list all of your system's current processes that are running into a console window using VB.NET. To load the snippet, go to File>New Project>Console Application and copy paste the module.

Module Processes
    Dim x As Integer = 0
    Sub Main()
        Dim pList() As System.Diagnostics.Process = _
        System.Diagnostics.Process.GetProcesses
        For Each proc As System.Diagnostics.Process In pList
            System.Console.WriteLine(proc.ProcessName & " " & proc.Id)
            x += 1
        Next 
        System.Console.WriteLine(vbCrLf + "*** Number of processes: " & x)
        System.Console.ReadLine()
    End Sub
End Module

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.