Opening a bat or exe file from pressing a button

Hi! :slight_smile:

I have created a button called Send e-mail, and what I want to do is this:

  1. I press the button.
  2. A bat(ch) file opens and launches Outlook.

Send-epost
Here is an image of the button (it’s in Norwegian).

Here is the code inside the batch file:

@Start "Outlook" "%ProgramFiles%\Microsoft Office\root\Office16\OUTLOOK.exe"

I found another topic on this (I think), but I didn’t really understand it.

How to trigger an external application or script? - General Discussion - Flipabit Forum

(This is my first post here, so let me know if there’s anything I can do to improve my questions :slight_smile: )

  1. To open the mail client to send an email, it is better to use the url scheme. See more here Send email with attachment - #4 by Michael
    image

  2. To open external script file you need to use Open url action, and pass the path to the file:
    image

  3. You can also run external applications directly
    image

Check the example run_outlook.pma (5.6 KB)

Code inside the batch file outlook.bat:
START outlook

1 Like

Thank you for the quick answer Michael! :smiley:

I tried to open the bat file via the url, but I got an error message.

file:///C:/Users/Fredrik Honningsvaag/Desktop/Heks Media App Flipabit/Batch Files/Launch Outlook/Launch Outlook.bat

Error bat

However, I converted the batch file into a .exe file and it worked like a charm! :smiley:

file:///C:/Users/Fredrik Honningsvaag/Desktop/Heks Media App Flipabit/Batch Files/Launch Outlook/Launch Outlook.exe

I hope this may help someone else in the future, and thank you for your help, Michael, you’re a life saver! :smiley: :black_heart:

Thanks for sharing!

The .BAT file will work if you use the START outlook command. For complex scripts, it’s better to use a PowerShell instead of a .bat

1 Like

Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.