After thinking it about it more, I think we should route all command execution on Windows build agents for Harbormaster through Powershell. This allows us to pass in arguments to a Windows process as an array, rather than attempting to escape characters on the command line.
Therefore we need a way of parsing a command line as a shell command (basically, turn a command string into a command name and argument array), which we then encode and pass through to Powershell to execute the command in a sane way.