如果我手动将其粘贴到命令提示符中,它会起作用,但如果我从python运行它,我会得到The filename, directgory name, or volume label syntax is incorrect
。
os.system('%comspec% /k ""C:Program FilesMicrosoft Visual Studio 9.0VCvcvarsall.bat"" x86')
os.system('devenv Immersica.sln /rebuild Debug /Out last-build.txt')
我认为反斜杠把你搞砸了。您需要使用R字符串(原始)
r"字符串"
请参阅https://docs.python.org/2/reference/lexical_analysis.html#string-引用的文字