0

I am trying to create an application in visual basic to open up a command prompt. I then want to type the word "Message" into the command prompt and have my application recognize the word "Message" and then run my application.

Any help leading me into the right direction would be greatly appreciated. Do I need to create a batch file or something else for this to work? Any advice, articles, or sample code is greatly appreciated. This is all new to me. I don't have much code, but this is what I have in visual basic:

Process.Start("cmd")
If (cmd.CommandText = "Message") Then
    'calls another class to actually run the program
End If
Scott
  • 65
  • 1
  • 1
  • 11

1 Answers1

0

It's the classic, good news and bad news.

The bad news is VBA can't do what you want natively. What you need to do is to call the "shell and wait" function, then capture it's output on the standard in.

This will require you to go beyond just VBA, and link into some windows guts (kernel32). The good news is that VBA makes that easy.

While I don't have source for you, a rather extensive article, with code here was referenced in this Stackoverflow Question

Hope this helps!

Community
  • 1
  • 1
Andrew Neely
  • 908
  • 11
  • 19
  • Thank you Andrew! I took a quick glance and it seems to be useful information. I will take a closer look at it here very soon. – Scott Feb 06 '15 at 15:35