I would like to Exit the CMD window after execution of script (currently I am exiting CMD manually by writing exit in the CMD window, after which VBA continues running)
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
Dim errorCode As Long
errorCode = wsh.Run(sCmdline, windowStyle, waitOnReturn)
'-- Finally Run function Arguments -----
errorCode = wsh.Run("cmd /k systeminfo >D:\Tools\MyScript\SystemInfo.txt", windowStyle, waitOnReturn)
If errorCode = 0 Then
MsgBox "Done! No error to report."
Set wsh = Nothing
Else
MsgBox "Program exited with error code " & errorCode & "."
Set wsh = Nothing
End If
cmd /kbycmd /c...