Running an .exe script from a VB script by passing arguments during runtime

I have converted a python script to .exe file. I just want to run the exe file from a VB script. Now the problem is that the python script accepts arguments during run-time (e.g.: serial port number, baud rate, etc.) and I cannot do the same with the .exe file. Can someone help me how to proceed?

Upvotes: 1

Views: 227

Answers (2)

Quantum Ghost
Quantum Ghost

Reputation: 120

If you have the source code of the Python script, you could change the source code and get command line arguments passed to the script from sys.argv, like this:

import sys
print(sys.argv)

Also, the argparse module may help you if the command line interface of your script is complex.

Documentation of sys module

Possibly Related Question

Upvotes: 1

Synaps3
Synaps3

Reputation: 1657

If you don't have the source to the python exe convertor and if the arguments don't need to change on each execution, you could probably open the exe in a debugger like ollydbg and search for shellexecute or createprocess and then create a string in a code cave and use that for the arguments. I think that's your only option.

Another idea: Maybe make your own extractor that includes the python script, vbscript, and python interpreter. You could just use a 7zip SFX or something.

Upvotes: 1

Related Questions