Ijaz Ur Rahim
Ijaz Ur Rahim

Reputation: 410

Pyinstaller - Hide and Run Executable file through .bat file

I am trying to add one executable (.exe) file, a .conf file and a .bat file into the binary package created by pyinstaller and then through that binary package i want to call the .bat file that will send some commands to .exe and that exe will pick the configuration file from .conf and do its work.

** Example **

  1. Click on Run button from Python Package.

  2. Python Package runs .bat file inside it.

  3. .bat file calls .exe with arguments

  4. .exe picks config from .conf file and do its work

Upvotes: 1

Views: 959

Answers (1)

Vikramaditya Gaonkar
Vikramaditya Gaonkar

Reputation: 717

Before you create the binary through pyinstaller:

  1. Add files (.conf and .bat and .exe) to the bundle using the Analysis call in the .spec file. When you run the binary created through pyinstaller it unpacks itself at a temporary location in AppData on Windows by default. You should be able to get that path through sys._MEIPASS
  2. In the python script run the .conf, .bat and .exe files preferably using subprocess.

Upvotes: 2

Related Questions