Using os.system in python to open a new cmd, change its directory and then run some code in the new cmd -
i trying use os.system .py file open new cmd, change directory , run separate commands in new cmd. after changing directory, command enter using '&&' in o.system runs in first cmd , not new one. know should use 'subprocess' module in place of 'os' both have same limitation. here snippet of similar code feel easy understand.
os.system('start /wait cmd /k cd c:/users/fenild/desktop/python/python 2.7 && echo "hello"')
here 'hello' prints in old cmd running file contains os.system command.
any ideas how can 'hello' print in new cmd?
Comments
Post a Comment