Python代码实现CMD指令
发布网友
发布时间:2022-04-23 02:18
我来回答
共2个回答
热心网友
时间:2022-04-18 16:03
os.system("cmd.exe python D:\\test\\rebuildShader\\rebuild_shader.py --source-version = 1.0.0")
这样不就行了?
热心网友
时间:2022-04-18 17:21
Microsoft Windows [版本 5.2.3790]
(C) 版权所有 1985-2003 Microsoft Corp.
D:\Docs> python hello.py
Hello, Python
D:\Docs> python hello.py Tim Wang
Hello, Tim
D:\Docs> python hello.py "Tim Wang"
Hello, Tim Wang
D:\Docs> python adj.py
Hello, from python
D:\Docs> type adj.py
#!/usr/bin/python
# encoding: utf-8
import os
os.system("""python hello.py "from python" """)
D:\Docs> type hello.py
#!/usr/bin/python
# encoding: utf-8
def hello(name):
print("Hello, %s" % name)
if __name__ == "__main__":
import sys
name = sys.argv[1] if len(sys.argv) > 1 else "Python"
hello(name)
D:\Docs>