Escape Characters in Windows’ CMD.EXE doesn't entirely work for me. I wanted to embed or escape quote characters in a command line, to give to the binPath parameter of sc.exe to create a windows service. But this contribution from John McNelly in the comments did give the solution:
You can also use ^ as a line continuation character for readability.
To escape an embedded ” use a backslash, useful with paths within “c:\Program Files” :
sc.exe create Foo ^
binPath= "\"C:\Program Files\foo.exe\" \"C:\Program Files\foo.ini\"" ^
displayName= "Hello, world"
Thanks John.
C:\Windows\system32>sc.exe create teagent binpath= “\”C:\Program Files\Tripwire\TE\Agent\bin\wrapper.exe\” -s \”C:\Program Files\Tripwire\TE\Agent\bin\agent.conf\”” DisplayName= “Tripwire Enterprise Agent”
[SC] CreateService SUCCESS