Skip to content

I'm trying to run the .exe through a bat file, #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mikefz010182 opened this issue Apr 2, 2023 · 4 comments
Open

I'm trying to run the .exe through a bat file, #756

mikefz010182 opened this issue Apr 2, 2023 · 4 comments
Assignees
Labels

Comments

@mikefz010182
Copy link

mikefz010182 commented Apr 2, 2023

Hello everyone, I have an .exe with interface and I want to run it from a bat file from my cmd command list, my .exe file has two text boxes:
Source File
Clue
I want to pass these two parameters through my bat file so that it is executed automatically, someone at some point has done something related or would have some ideas on how I could do it, greetings to all.

image

when executing my bat file it only opens the program but does not pass my parameters to my interface of my .exe

image

@GregorBiswanger
Copy link
Member

Our API leans towards the capabilities of the native Electron. Support for parameters with the native Electron works via command line switches. https://www.electronjs.org/docs/latest/api/command-line-switches

I'll show you how to use the command line switches with Electron.NET here:
#337 (comment)

@GregorBiswanger
Copy link
Member

Please let me know if the solution helped.

@mikefz010182
Copy link
Author

image
Hi GregaroBiswanger, I'm trying but I'm still stuck with the new script you sent me, I don't know if I'm applying the syntax correctly

image

@FlorianRappl
Copy link
Collaborator

FlorianRappl commented Apr 3, 2023

Hm - you write JavaScript in a bat file...

Again, follow the steps outlined in the referenced issue:

  1. Add the args to the call of the exe (e.g., myapp.exe /args --dog=woof --test=true)
  2. You'll need a JS file run inside the electron application - this way you can call, e.g., app.CommandLine.HasSwitchAsync where app is the global application imported from the electron package

The (2) can also be read / achieved inside Electron.NET. The API has the CommandLine object that exposes the functionality from the app.CommandLine object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants