Search for Directories/files/Folders

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eSolTec, Inc. 501(c)(3)

    #1

    Search for Directories/files/Folders

    Thank you in advance for any and all assistance. I'm looking for a way to
    programmaticall y scan all installed drives for programs that are installed.
    Can someone point me to code to look for say, "keywords" on the installed
    drives etc?

    --
    Michael Bragg, President
    eSolTec, Inc.
    a 501(C)(3) organization
    MS Authorized MAR
    looking for used laptops for developmentally disabled.
  • rowe_newsgroups

    #2
    Re: Search for Directories/files/Folders

    Here's a console app I just threw together that will run through and
    list all exes that the program has access to. You should be able to
    modify it to do what you need. Let me know if you need more help.

    Thanks,

    Seth Rowe


    Module Module1

    Sub Main()
    ListAllExes("C:/")
    Console.WriteLi ne("done")
    Console.Read()
    End Sub

    Private Sub ListAllExes(ByV al path As String)
    Try
    ' Change the "*.exe" to your search condition
    Dim filenames() As String =
    System.IO.Direc tory.GetFiles(p ath, "*.exe")
    For i As Int16 = 0 To filenames.Lengt h - 1
    Console.WriteLi ne(filenames(i) )
    Next
    Dim directories() As String =
    System.IO.Direc tory.GetDirecto ries(path)
    For i As Int16 = 0 To directories.Len gth - 1
    ListAllExes(dir ectories(i))
    Next
    Catch ex As Exception
    ' do nothing
    End Try
    End Sub

    End Module


    eSolTec wrote:
    Thank you in advance for any and all assistance. I'm looking for a way to
    programmaticall y scan all installed drives for programs that are installed.
    Can someone point me to code to look for say, "keywords" on the installed
    drives etc?
    >
    --
    Michael Bragg, President
    eSolTec, Inc.
    a 501(C)(3) organization
    MS Authorized MAR
    looking for used laptops for developmentally disabled.

    Comment

    • eSolTec, Inc. 501(c)(3)

      #3
      Re: Search for Directories/files/Folders

      Seth,

      Thank you for the demo console app. I'm looking to find particular programs
      installed. Do you think I can modify this to find say all "symantec" programs
      or "mcafee" ?
      --
      Michael Bragg, President
      eSolTec, Inc.
      a 501(C)(3) organization
      MS Authorized MAR
      looking for used laptops for developmentally disabled.


      "rowe_newsgroup s" wrote:
      Here's a console app I just threw together that will run through and
      list all exes that the program has access to. You should be able to
      modify it to do what you need. Let me know if you need more help.
      >
      Thanks,
      >
      Seth Rowe
      >
      >
      Module Module1
      >
      Sub Main()
      ListAllExes("C:/")
      Console.WriteLi ne("done")
      Console.Read()
      End Sub
      >
      Private Sub ListAllExes(ByV al path As String)
      Try
      ' Change the "*.exe" to your search condition
      Dim filenames() As String =
      System.IO.Direc tory.GetFiles(p ath, "*.exe")
      For i As Int16 = 0 To filenames.Lengt h - 1
      Console.WriteLi ne(filenames(i) )
      Next
      Dim directories() As String =
      System.IO.Direc tory.GetDirecto ries(path)
      For i As Int16 = 0 To directories.Len gth - 1
      ListAllExes(dir ectories(i))
      Next
      Catch ex As Exception
      ' do nothing
      End Try
      End Sub
      >
      End Module
      >
      >
      eSolTec wrote:
      Thank you in advance for any and all assistance. I'm looking for a way to
      programmaticall y scan all installed drives for programs that are installed.
      Can someone point me to code to look for say, "keywords" on the installed
      drives etc?

      --
      Michael Bragg, President
      eSolTec, Inc.
      a 501(C)(3) organization
      MS Authorized MAR
      looking for used laptops for developmentally disabled.
      >
      >

      Comment

      • rowe_newsgroups

        #4
        Re: Search for Directories/files/Folders

        If they use a certain naming convention you could just search for that.

        Thanks,

        Seth Rowe


        eSolTec, Inc. 501(c)(3) <esol...@noemai l.nospamwrote:
        Seth,
        >
        Thank you for the demo console app. I'm looking to find particular programs
        installed. Do you think I can modify this to find say all "symantec" programs
        or "mcafee" ?
        --
        Michael Bragg, President
        eSolTec, Inc.
        a 501(C)(3) organization
        MS Authorized MAR
        looking for used laptops for developmentally disabled.
        >
        >
        "rowe_newsgroup s" wrote:
        >
        Here's a console app I just threw together that will run through and
        list all exes that the program has access to. You should be able to
        modify it to do what you need. Let me know if you need more help.

        Thanks,

        Seth Rowe


        Module Module1

        Sub Main()
        ListAllExes("C:/")
        Console.WriteLi ne("done")
        Console.Read()
        End Sub

        Private Sub ListAllExes(ByV al path As String)
        Try
        ' Change the "*.exe" to your search condition
        Dim filenames() As String =
        System.IO.Direc tory.GetFiles(p ath, "*.exe")
        For i As Int16 = 0 To filenames.Lengt h - 1
        Console.WriteLi ne(filenames(i) )
        Next
        Dim directories() As String =
        System.IO.Direc tory.GetDirecto ries(path)
        For i As Int16 = 0 To directories.Len gth - 1
        ListAllExes(dir ectories(i))
        Next
        Catch ex As Exception
        ' do nothing
        End Try
        End Sub

        End Module


        eSolTec wrote:
        Thank you in advance for any and all assistance. I'm looking for a way to
        programmaticall y scan all installed drives for programs that are installed.
        Can someone point me to code to look for say, "keywords" on the installed
        drives etc?
        >
        --
        Michael Bragg, President
        eSolTec, Inc.
        a 501(C)(3) organization
        MS Authorized MAR
        looking for used laptops for developmentally disabled.

        Comment

        • Steven Cheng[MSFT]

          #5
          Re: Search for Directories/files/Folders

          Hello Michael,

          As Rowe has mentioned, you can use the System.IO's class to query and
          search certain drives and directories on the machine. However, it is
          important that you know tha keywords or naming convention of the programs
          you want to search.

          BTW, based on my experience, most program will add some configuration and
          installation information in the system registry(under
          HKEY_LOCAL_MACH INE\SOFTWARE key). For example, the Adobe reader will add
          information like InstallPath, version in its registry key:

          HKEY_LOCAL_MACH INE\SOFTWARE\Ad obe\Acrobat Reader

          Mozilla firefox will add its exeutable's name and path through the
          following keys:

          PathToExe
          Program Folder Path

          Therefore, you can also consider performing search in windows system
          registry for the certain program's installation information and then
          perform further search upon file system. How do you think? Here are some
          reference about registry accessing in .net:

          http://www.codeguru.com/csharp/cshar...ticle.php/c103
          09/




          Sincerely,

          Steven Cheng

          Microsoft MSDN Online Support Lead



          =============== =============== =============== =====

          Get notification to my posts through email? Please refer to
          http://msdn.microsoft.com/subscripti...ult.aspx#notif
          ications.



          Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
          where an initial response from the community or a Microsoft Support
          Engineer within 1 business day is acceptable. Please note that each follow
          up response may take approximately 2 business days as the support
          professional working with you may need further investigation to reach the
          most efficient resolution. The offering is not appropriate for situations
          that require urgent, real-time or phone-based interactions or complex
          project analysis and dump analysis issues. Issues of this nature are best
          handled working with a dedicated Microsoft Support Engineer by contacting
          Microsoft Customer Support Services (CSS) at
          http://msdn.microsoft.com/subscripti...t/default.aspx.

          =============== =============== =============== =====



          This posting is provided "AS IS" with no warranties, and confers no rights.



          Comment

          • HKSHK

            #6
            Re: Search for Directories/files/Folders

            Dear Mr. Bragg,
            Seth,
            >
            Thank you for the demo console app. I'm looking to find particular programs
            installed. Do you think I can modify this to find say all "symantec" programs
            or "mcafee" ?
            If you are looking for such (installed) programs, then perhaps it is
            easier to check the registry. Maybe you find the path there
            (HKLM\SOFTWARE\ ...). Getting the result from there should be much
            quicker than scanning the hard drive. Of course, this won't help if you
            need a list of ALL programs (no matter if installed or copied).

            Best Regards,

            HKSHK

            Comment

            Working...