-1

How can i open .exe file from the multiple folders in single click using vb.net or any other way? tried using process.start method but it's not working properly and found error can't find path. Example:

For Each Dir As String In Directory.GetDirectories(Application.StartupPath)
    Process.Start(Dir & "\" & "*.exe")
Next
Theo
  • 57,719
  • 8
  • 24
  • 41
  • https://stackoverflow.com/a/8676577/34092 will show you how to get the names of the `EXE` files. Then `Process.Start` them **one by one**. – mjwills Oct 12 '19 at 11:06

1 Answers1

0

This will try to run all EXE files in the folder "myPath" and subfolders

Imports System.IO
Module Module1

    Sub Main()

        Dim pattern As String
        pattern = "*.EXE"

        Dim myPath As String
        myPath = "your Path"    ' Adjust to your needs

        Dim exeLst As IEnumerable(Of String)

        exeLst = Directory.EnumerateFiles(myPath, pattern, SearchOption.AllDirectories)

        Dim sngFile As String
        For Each sngFile In exeLst
            Process.Start(sngFile)
        Next

    End Sub

End Module
Storax
  • 11,158
  • 3
  • 16
  • 33