I have a one line command that I can run in CMD to populate a program with some parameters. The command its the following:
FOR /L %I in (16,1,20) DO "C:PathToProgramprogram_executable.exe" --do-things="C:Paththis.item|C:Paththat%I.item|Text%I"
The thing is that I'm trying to achieve the same in Python 3.X and I'm unable to correctly pass the parameter information (--do-things="C:Paththis.item|C:Paththat%I.item|Text%I"). I've tried with subprocess.Popen, system.call and with both using a list of executable + parameter and a string of all the line all together:
['C:\Path\To\Program\program_executable.exe', '--do-things="C:\Path\this.item|C:\Path\that16.item|Text16"]
and
r'C:\Path\To\Program\program_executable.exe --do-things="C:\Path\this.item|C:\Path\that16.item|Text16'
The only thing I can do its start the program (as it calls the command), but it doesn't seem to be passing the args to it. I think the issue is that the args need the "" inside and Python doesn't seem to be able to properly send them, despite that I've tried escaping them just in case.
The CMD command that it should launch, should be something like this:
C:>"C:PathToProgramprogram_executable.exe" --do-things="C:Paththis.item|C:Paththat20.item|Text20"
Any idea how to achieve this from Python 3.X?
- - , .
برچسب:
نویسنده: استخدام کار