简体   繁体   English

如何在不打开 CMD window 的情况下通过 subprocess.call() 运行 CMD 命令?

[英]How to run CMD commands via subprocess.call() without opening CMD window?

I'm able to run commands through CMD with Python with subprocess.call('insert command here') but it opens the CMD window then closes right away. I'm able to run commands through CMD with Python with subprocess.call subprocess.call('insert command here') but it opens the CMD window then closes right away. Is there a way to not open it at all?有什么办法完全不打开吗?

You can set shell=True when calling subprocess.call :您可以在调用subprocess.call时设置shell=True

subprocess.call('insert command here', shell=True)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM