How do I open an application on my desktop using just arduino code?

So, I've encountered a roadblock while trying to introduce new features into a program. I intend to open up Command prompt when a certain option is chosen. I also have an existing .bat file which does everything necessary so that the user can read the data as an alternative. If someone can help with opening cmd, that'd be greatly appreciated.

Which Arduino board are you using ?

If you want to do it purely via Arduino code, you would need to use an Arduino board with keyboard emulation capabilities (e.g, Arduino Leonardo, Micro, MKR Boards, Nano 33 IoT) and then emulate the keystrokes to open cmd and run the batch file.

However, I think you will be better off to create a Windows shortcut to the batch file and then associate a dedicated keyboard shortcut to that shortcut. You can do that by right clicking the Windows shortcut, selecting "Properties" from the context menu, and then defining the keyboard shortcut in the "Shortcut key" field. Then you only need to make the Arduino board emulate that single keyboard shortcut to execute the batch file.

Arduino Uno

See the advice in post #3 about using an Arduino that can emulate a keyboard, which the Uno cannot do

Ah I see, how do I emulate the keystrokes?

Got it, thanks!

Use the Keyboard library:

Noted, I'll check that out asap. Thank you :slight_smile:

Of course it is vastly easier if you use a multi-user system - Linux (Mint) - where you can attach a terminal to a plain serial port and use essentially any Arduino to "talk" to the Command prompt. :grin:

Interesting, might try that out too. Do you happen to have any reference links? I'd be grateful if you could send them over.