0

The title may not be the best description of what I'm trying to do. I made a few simple lines of code to run a .exe, in this case the adobe reader installer.

import os
os.system('"D:/Python Project/Work Project/Installers/readerdc_en_xa_crd_install.exe"')

currently the code and .exe are in the same folder but if I were to move the entire folder to another machine obviously the file path for the .exe would no longer be the same. How do I go about running a .exe that is in the same folder as the code without relying on the entire file path of the machine?

Thanks

1 Answers1

0
import os
mypath = os.path.abspath(os.path.dirname(__file__))
os.system( f'"{mypath}/readerdc_en_xa_cer_install.exe"' )
alfinkel24
  • 551
  • 5
  • 13
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30