Using Subprocess.popen (shell=true) With Windows Folders
I'm currently looking at Popen to automate the compression & storage of documents. For the compression part, I thought of the following Python line: subprocess.Popen('WinRAR.ex
Solution 1:
In Windows you should use quotes for file or directory names (if you want to use spaces inside). In Python, you should escape quotes with \ symbol (if you are using strings inside " quotes). Like this:
"my name is \"Mark\"!"
Or just:
'my name is "Mark"!'
So this will work as expected:
subprocess.Popen("WinRAR.exe a -r \"c:\\03. Notes\\AllTexts\" *.txt", shell=True)
As well as:
subprocess.Popen('WinRAR.exe a -r "c:\\03. Notes\\AllTexts"*.txt', shell=True)
Post a Comment for "Using Subprocess.popen (shell=true) With Windows Folders"