I'm new with Electron and Vue JS and i want to try to execute an .exe file just by clicking on a button but it doesn't work and i don't understand why. I'm using child_process
from nodeJS, i have node 18.
This is my code :
<template>
<div class="about">
<h1>This is an about page</h1>
<button @click="executerExe"> Execute </button>
</div>
</template>
<script>
import { execFile } from 'child_process';
export default {
methods: {
executerExe() {
const executablePath = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
execFile(executablePath, (error) => {
if (error) {
alert("Une erreur produite") ;
} else {
alert('Le fichier .exe a été exécuté avec succès !') ;
}
});
},
},
};
</script>
Actually, nothing happen with this code when i click on the button "Execute". I know the call is working because i created an alert at the beginning of the method and it works. But the execution of the .exe isn't working.
If you have any idea, I will be grateful =)