I'm trying to add a value to the registry which contains spaces and for that reason i want to retain double quotes.
I've tried escaping double quotes with '\"' but this had no effect
path_with_spaces = "C:\Users\me\i have space\app.exe"
argument_with_spaces = "Quick brown fox"
data = '"{}" -n "{}"'.format(path_with_spaces, argument_with_spaces)
command = 'REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f /v test /d "{}"'.format(data)
subprocess.call(command)
if i print "command" i get:
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /f /v test /d ""C:\Users\me\i have space\app.exe" -n "Quick brown fox""
but there are no double quotes to be seen while inspecting the result with regedit. Even if i do this:
data = '\"{}\" -n \"{}\"'.format(path_with_spaces, argument_with_spaces)
There is no change. The output when inspecting with regedit is always like this:
C:\Users\me\i have space\app.exe -n Quick brown fox
What am i doing wrong?