Execute CLI command on button click


#1

Hello. I am new to the Electron. I want to make a program which executes an .exe file with specified arguments. For example, normally i would open windows CLI and write
/Folder/subfolder/program.exe -argument1
Instead, I want to open my Electron application, click a button and have the program executed for me by the electron app.
I’ve managed to find the “require(‘child_process’).execFile;” thing, and i like it, as i can store path as a variable. However, I don’t know how to execute programs with the arguments. Also, I have no idea how to execute the program on button click, if i put my code in main.js the program executes immediatly on electron app start. Last thing, I can’t figure how to get file path from user in my app and use this file path in the program execution code.
I’ll be very thankful for any help.