gunpowder
gunpowder

Reputation: 19

Python how to start a program from current working directory

For example in batch (windows) you can use %CD%\ or .\ to start something from cwd but I dont know how to do it on python...

I triedsubprocess.call(['.\somedirectory\someprogram.exe']) And subprocess.call(['\\somedirectory\someprogram.exe'])

edit: Also the command I used in batch is: start %CD%\somedirectory\someprogram.exe or start .\somedirectory\someprogram.exe

Upvotes: 1

Views: 54

Answers (1)

frankenapps
frankenapps

Reputation: 8241

I havent tested it but this should work:

from subprocess import call
call(["start %CD%\somedirectory\someprogram.exe", "-l"])

However your filepath declaration seems a bit strange to me.

Upvotes: 0

Related Questions