Why is the command string not passed entirely from Python to system?
Question: My Python code is:

    
    
    import os
    targetdir = os.getenv('APPDATA')
    command = "elev.cmd {0}\data\nssm.exe install service {1}\data\service.exe".format(targetdir,targetdir)
    os.system(command)
    

I am completely fine with using `os.system`. `elev.cmd` generates UAC dialog
and elevates and executes everything what's passed to it.

But my suspect is that the arguments are passed to the command in two lines.

What is the reason for command line string being passed not completely in one
line?


Answer: Yes, you are not escaping your command string properly , so `\` is interpreted
as escape character, hence `\n` would get interpreted as newline, and not `\`
followed by `n`.

Prefix the string with `r` to make it raw-string, so that `\` does not act as
escape characters.

    
    
    command = r"elev.cmd {0}\data\nssm.exe install service {1}\data\service.exe".format(targetdir,targetdir)
    

