Home All Groups Group Topic Archive Search About

Search for Directories/files/Folders

Author
10 Oct 2006 10:55 PM
eSolTec, Inc. 501(c)(3)
Thank you in advance for any and all assistance. I'm looking for a way to
programmatically 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.

Author
10 Oct 2006 11:54 PM
rowe_newsgroups
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.WriteLine("done")
        Console.Read()
    End Sub

    Private Sub ListAllExes(ByVal path As String)
        Try
            ' Change the "*.exe" to your search condition
            Dim filenames() As String =
System.IO.Directory.GetFiles(path, "*.exe")
            For i As Int16 = 0 To filenames.Length - 1
                Console.WriteLine(filenames(i))
            Next
            Dim directories() As String =
System.IO.Directory.GetDirectories(path)
            For i As Int16 = 0 To directories.Length - 1
                ListAllExes(directories(i))
            Next
        Catch ex As Exception
            ' do nothing
        End Try
    End Sub

End Module


eSolTec wrote:
Show quoteHide quote
> Thank you in advance for any and all assistance. I'm looking for a way to
> programmatically 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.
Author
11 Oct 2006 12:09 AM
eSolTec, Inc. 501(c)(3)
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.


Show quoteHide quote
"rowe_newsgroups" 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.WriteLine("done")
>         Console.Read()
>     End Sub
>
>     Private Sub ListAllExes(ByVal path As String)
>         Try
>             ' Change the "*.exe" to your search condition
>             Dim filenames() As String =
> System.IO.Directory.GetFiles(path, "*.exe")
>             For i As Int16 = 0 To filenames.Length - 1
>                 Console.WriteLine(filenames(i))
>             Next
>             Dim directories() As String =
> System.IO.Directory.GetDirectories(path)
>             For i As Int16 = 0 To directories.Length - 1
>                 ListAllExes(directories(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
> > programmatically 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.
>
>
Author
11 Oct 2006 12:20 AM
rowe_newsgroups
If they use a certain naming convention you could just search for that.

Thanks,

Seth Rowe


eSolTec, Inc. 501(c)(3) <esol...@noemail.nospam> wrote:
Show quoteHide quote
> 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_newsgroups" 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.WriteLine("done")
> >         Console.Read()
> >     End Sub
> >
> >     Private Sub ListAllExes(ByVal path As String)
> >         Try
> >             ' Change the "*.exe" to your search condition
> >             Dim filenames() As String =
> > System.IO.Directory.GetFiles(path, "*.exe")
> >             For i As Int16 = 0 To filenames.Length - 1
> >                 Console.WriteLine(filenames(i))
> >             Next
> >             Dim directories() As String =
> > System.IO.Directory.GetDirectories(path)
> >             For i As Int16 = 0 To directories.Length - 1
> >                 ListAllExes(directories(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
> > > programmatically 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.
> >
> >
Author
11 Oct 2006 3:35 AM
Steven Cheng[MSFT]
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_MACHINE\SOFTWARE  key).  For example, the Adobe reader will add
information like InstallPath, version in its registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\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/csharp/cs_misc/userinterface/article.php/c103
09/

http://www.csharphelp.com/archives2/archive430.html


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



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

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.

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



This posting is provided "AS IS" with no warranties, and confers no rights.
Author
11 Oct 2006 6:59 AM
HKSHK
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