简体   繁体   中英

VB.NET - How to open files of a given file type?

I want a quick way to open a bunch of Visual Studio projects at once. I have a collection of folders, and I want to run some code that runs through each subfolder and opens the file that ends with ".sln". In pseudocode:

For each SubFolder in ProjectsFolder
    Open SubFolder
    Start "\*.sln"
Next

Might be I've missed something obvious, but I couldn't find anything helpful through Google.

Try using the Process class:

Dim parentFolder As New DirectoryInfo("c:\myfolder")
For Each f As FileInfo In parentFolder.GetFiles("*.sln", _
                                                SearchOption.AllDirectories)
  Process.Start(f.FullName)
Next

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM