Use subprocess.list2cmdline() for Windows, and pipes.quote() for BSD/Linux command execution.