Results 1 to 12 of 12

Thread: Search For All Exe's

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    51

    Resolved Search For All Exe's

    How can i search the computer for all the exe files?
    So the program returns the path of the file, mabye into a listbox, all a text file, thats not the important bit.

    Any Ideas how to search the computer for .exe files?

    And would i be able to change exe to any other file type ?

    thanks

    i ParadoX
    Last edited by iParadox; Jan 7th, 2005 at 01:13 PM. Reason: to resolve the thread

  2. #2

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    51

    Re: Search For All Exe's

    I dont mean like change the file type of the EXE, i meant like change the search criteria to search for jpg or Wav files.

    But its looking for EXE's thats i need to be able to do

    Any ideas?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Search For All Exe's

    Are you talking about your VB program emulating the Windows Search?

  5. #5
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497

    Re: Search For All Exe's

    You could use the VB dir function to find a file pattern in a specific directory.

    You could use the DOS dir function with the /S option to find files in subdirectories too, and any other option to format the output, and redirect output to a file. Then open the file and have your way with it.

    There's also an API call to FindFile or something like that, but I forget. Not much help there, but you could look or someone else might remember what it is.
    end war
    stop greed

  6. #6
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Search For All Exe's

    Quote Originally Posted by vbmom
    You could use the VB dir function to find a file pattern in a specific directory.

    You could use the DOS dir function with the /S option to find files in subdirectories too, and any other option to format the output, and redirect output to a file. Then open the file and have your way with it.

    There's also an API call to FindFile or something like that, but I forget. Not much help there, but you could look or someone else might remember what it is.
    To list files in a directory : http://www.vbforums.com/showthread.php?t=244915


    Has someone helped you? Then you can Rate their helpful post.

  7. #7

  8. #8

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    51

    Re: Search For All Exe's

    Thanks fo the help, the link;
    http://www.vbforums.com/showthread.php?t=244915
    Really helped, as that program is nearly what i want.

    Then only thing that i want to change, and i cant figure out how is:

    1 The program wont search sub-directories, can the code be edited to be able to do that.

    2 I cant Figure out how to change the Program so it only Searches for Exe Files, can anyone help me on how to change the code?

    If you do not want to download the File then the code is below, Thanks!

    iParadoX




    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim strStartPath As String
    3.     strStartPath = "C:\" 'ENTER YOUR START FOLDER HERE
    4.     ListFolder strStartPath
    5. End Sub
    6.  
    7. Private Sub ListFolder(sFolderPath As String)
    8.     Dim FS As New FileSystemObject
    9.     Dim FSfolder As Folder
    10.     Dim File As File
    11.     Dim i As Integer
    12.    
    13.     Set FSfolder = FS.GetFolder(sFolderPath)
    14.     Text1.Text = ""
    15.     For Each File In FSfolder.Files
    16.         DoEvents
    17.         Text1.Text = Text1.Text & File & vbCrLf
    18.     Next File
    19.     Set FSfolder = Nothing
    20. End Sub
    Last edited by iParadox; Jan 7th, 2005 at 09:00 AM. Reason: made a small mistake

  9. #9

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    51

    Re: Search For All Exe's

    I can now get a listbox and populate it with the names of the exe files, but this method does not show the whole path of the application, which i desperatly need it to do.

    Also also will only search in one directory, and not search the subdirectories, can i edit the code to allow that?

    Thanks a lot

    the code is

    VB Code:
    1. Private Sub ListFiles(strPath As String, Optional Extention As String)
    2. 'Leave Extention blank for all files
    3.     Dim File As String
    4.    
    5.     If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"
    6.    
    7.     If Trim$(Extention) = "" Then
    8.         Extention = "*.*"
    9.     ElseIf Left$(Extention, 2) <> "*." Then
    10.         Extention = "*." & Extention
    11.     End If
    12.    
    13.     File = Dir$(strPath & Extention)
    14.     Do While Len(File)
    15.         List1.AddItem File
    16.         File = Dir$
    17.     Loop
    18. End Sub
    19.  
    20. Private Sub Form_Load()
    21. ListFiles "C:\", "txt"
    22. End Sub

  10. #10

  11. #11

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    51

    Re: Search For All Exe's

    thanks For all your Help

    iParadoX

  12. #12
    Addicted Member thiru_rajamani's Avatar
    Join Date
    Aug 2004
    Location
    Chennai,India
    Posts
    214

    Re: Search For All Exe's

    Really a good threat
    Thanks
    Raj

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