I am building a script to cleanup certain temp folders and then run a install.exe file.
I have the cleaning of temp folders all working but cannot get the exe to run.
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
Dim oFSO, strAppData, objShell
objShell = CreateObject("WScript.Shell")
oFSO = CreateObject("Scripting.FileSystemObject")
For Each sf In oFSO.GetFolder("C:\Users").SubFolders
sf = oFSO.BuildPath(sf.Path, "Downloads\")
If oFSO.FolderExists(sf) Then Shell("test.exe")
Next
End Sub`
I tried using the same way I was deleting the temp folders to locate the downloads folder and run the test.exe file but no luck
I was able to get it working!
Dim usernamepath As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
Dim thefolder = usernamepath + "\Downloads"
Dim startInfo As New System.Diagnostics.ProcessStartInfo(thefolder & "\test.exe")
startInfo.WorkingDirectory = usernamepath + "\Downloads"
System.Diagnostics.Process.Start(startInfo)