0

I'm trying to run a command through cmd - but it's not being recognized.

import os
cmd = '"C:\\Program Files (x86)\\PATH TO PROGRAM" "C:\\Users\\PATH TO FILE" /r /e'
os.system(str(cmd))

I know the str(cmd) isn't needed, but just wanted to show that I tried. The error I'm getting is:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

I looked around and I know it's because I should use quotes, but I am using quotes for my path. I tried other ways to get around it like:

TCPath = '"C:\\Program Files (x86)PATH"'
PPath = '"C:\\Users\\PATH"'
cmd = TCPath + ' ' + PPath + ' /r /e'
os.system(str(cmd))

And I keep getting the same error. Any thoughts on this? I tried \" too but that didn't work either.

0 Answers0