简体   繁体   中英

Open Command Prompt with specific directory using Python

How can I open command prompt with specific directory using Python?

I could just run command prompt using Python but I'm unable to open with specific directory.

import os
os.system("start cmd")

You can open the specific path using this

import os
os.system("start cmd /K cd C:\\Users\\Name\\Desktop\\File" )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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