By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

link between python and the windows command prompt

P: n/a
hi! i need to know how i can run ussal commands that i ussally type at
the windows command prompt from a python file. that is for example
from the windows command prompt i ussually type "cd D:\folder\ nec2++ -
i inputfile.nec -o outputfile.out " now how can i execute this
command that i ussually type at the windows command prompt from a
python file?
i know it has to do with the sys and os module but how specifically?
what commands? any references?

Jul 23 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
yadin wrote:
hi! i need to know how i can run ussal commands that i ussally type at
the windows command prompt from a python file. that is for example
from the windows command prompt i ussually type "cd D:\folder\ nec2++ -
i inputfile.nec -o outputfile.out " now how can i execute this
command that i ussually type at the windows command prompt from a
python file?
i know it has to do with the sys and os module but how specifically?
what commands? any references?
You can use os.system or if your needs are more complex, take a look at the
subprocess module.

import os
import sys

os.chdir('D:\\folder')
os.system('D:\\nec2++ -i inputfile.new -o outputfile.out')

-Larry
Jul 23 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.