Public Function ShellExecute(ByVal CommandLine As String, Optional ByRef Result As String, Optional ByRef ErrorMessage As String, Optional ByVal TimeoutMS As Long = 0, Optional ByVal RunAsAdministrator As Boolean = False) As Boolean
Runs a command in the file system. Returns a boolean indicating successful run. Returns False in case of error or time out (process did not finish within the time specified).
Dim lCommandResult As String
Dim lErrorMessage As String
If ShellExecute("C:\Temp\MyCommand.exe", lCommandResult, lErrorMessage) Then
SendDebug $"The command returned: {lCommandResult}"
Else
Senddebug $"An error occurred: {lErrorMessage}"
End If