I have multiple Python scripts and I formed an .exe using pyinstaller. How do i get the name of the exe?
I tried
file_path = os.path.dirname(os.path.realpath(__file__))
print(file_path)
exename = os.path.basename(__file__)
print(exename)
USER_NAME = getpass.getuser()
bat_path = r'C:\Users\%s\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup' % USER_NAME
print(bat_path)
with open(bat_path + '\\' + "open.bat", "w+") as bat_file:
bat_file.write(r'start "" %s' % file_path)
and it's writing this on the .bat file:
start "" C:\Users\sg\AppData\Local\Temp\_MEI235882
Is this correct? When I tried running this on the terminal I got an error, I was expecting
start "" C:\Users\sg\AppData\Local\Temp\<my executable name>
This looks different
You can use sys.executable
to get the executable file