Private Sub Command1_Click()
Shell ("cmd.exe")
End Sub

Private Sub Command2_Click()
Shell ("calc.exe")
End Sub

Private Sub Command3_Click()
Shell ("explorer.exe")
End Sub

Private Sub Command4_Click()
Shell "winver.exe"
End Sub

Private Sub Command5_Click()
Shell "C:\Program Files\Windows Media Player\wmplayer.exe"
End Sub

above code is able to open the pre-installed windows programs. But now i want my program to have a button which could be able to open the program without providing the full installed directory path, i.e, automatically search for the app and open it.
e.g.: Instead of writing "C:\Program Files\Windows Media Player\wmplayer.exe", i want to write only "wmplayer.exe" or "vlc.exe"...

It would have to be in your %PATH% environment variable. You can set this manually, per application. For example, you'd need to add C:\Program Files\Windows Media Player\, and the directories where any executable you wish to use in this manner, to the path variable

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.