pythondirectoryquotesrarappdata

Extract a rar file in a double quoted folder with python


Hi how i can add the double quotes to a folder ? with a initial " and a final " ? in a python file without receiving errors ?

this is the bat file with quotes

rar.exe x -o+ -p12345pass temp.rar "%Localappdata%\Temp\"

and this is the python file without quotes

win32api.WinExec("cmd.exe /c rar.exe x -o+ -p12345pass temp.rar %Localappdata%\\Temp\\",0)


Solution

  • Using single quotes can help you too:

    win32api.WinExec('cmd.exe /c rar.exe x -o+ -p12345pass temp.rar \"%Localappdata%\\Temp\\\"',0)