I am currently trying to run a specific command in a windows terminal, but from a Python (3.7.7) script. I know that this command works in CMD terminal:
"F:\Prog Folder\7-Zip\7z" e "F:\Folder Name\Zipfile.7z" -o"F:\Folder Name\Dolphin Folder" *.iso -mx5
However, due to syntax and sensitivity of Windows, it isn't that simple to call the subprocess and use the same command. Here is what I have now as part of my python script:
import subprocess
subprocess.run(['cmd', '/k', "\"\"F:\Prog Folder\7-Zip\7z\" \"x\" \"F:\Folder Name\Zipfile.7z\" \"-o\"F:\Folder Name\Dolphin Folder\"\" \"*.iso\" \"-mx5\"\""])
I have also tried (subprocess.call) and am still getting this error from cmd terminal and cannot figure out the problem:
The filename, directory name, or volume label syntax is incorrect.
Any recommendations or advice for this? I know the backslashes are sensitive, but I thought I had it correct...
EDIT:
I have tried the suggestions in the comments:
os.system(""F:\Prog Folder\7-Zip\7z" e "F:\Folder Name\Zipfile.7z" -o"F:/Folder Name/Dolphin Folder" *.iso -mx5")
This gave me an "invalid syntax" error and highlighted the drive letter "F"
I have tried subprocess.call and subprocess.run as indicated on Calling an external command from Python with no luck. I just need to basically execute the same line of code that works in CMD but through python; so it must be that syntax is the issue, but no pre-existing question on StackOverflow works with my situation...