Reputation: 37
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
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.
Upvotes: 1
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