Results 1 to 2 of 2

Thread: [2008] creating command line proggy. paging help

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    [2008] creating command line proggy. paging help

    Hey guys, thought it would be a good idea on creating a command line for WMI.

    for example, i got this working:

    myexe /p [outputs a whole bunch of information on the processor]

    but the thing is that its too much information for it to fit on one page so i have to scroll up to view information. view screenshot!

    so what I want to do is create some sort of paging ability. What I mean by that is, when you go Command or Dos, and execute a command (lets say dir to display a list of directories).. it shows a whole bunch of them.

    but if you want to view them page by page so they dont auto scroll, you can try dir /p which pages them. (go and try in on the windows directory :P)

    so how can i implement it using my argument of -p ?

    If I am still confusing, please view this screenshot. this is exactly how I want it
    http://www.imgpig.com/uploads/48564_...pageoption.jpg


    My subroutines are rather simple. here's an example of one:

    Code:
      Sub FullDiskInfo()
            Try
                Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk")
    
                For Each queryObj As ManagementObject In searcher.Get()
                    For Each q In queryObj.Properties
                        If options.Contains("t") Then
                            If Not String.IsNullOrEmpty(q.Value) Then
                                Console.Write(q.Name & ": ")
                                Console.WriteLine(q.Value)
                            End If
                        Else
                            Console.Write(q.Name & ": ")
                            Console.WriteLine(q.Value)
                        End If
                       
                    Next
                Next
            Catch ex As ManagementException
                Console.WriteLine("An error occured while in communication with the system")
            End Try
        End Sub
    link to ss: http://www.imgpig.com/uploads/43422_cmdlinehelp.jpg

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: [2008] creating command line proggy. paging help

    Have a counter that counts how many times you write a line, then find a good fixed number that doesn't go beyond the edge of the standard console size, and when the counter is equal to that max value, do a ReadLine("Press any key to continue"), and reset the counter.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width