Newbie - pass variable to cscript

G

Gabriel Genellina

It's not firing off the vbs script. Have I got the syntax correct?
Thanks.

My latest attempt:
vBS = "C:\\Program Files\\nasa\\nmail.vbs"
os.system('cscript /from:[email protected] /
to:p[email protected] /sub:TEST /msg:hello ' + vBS)

Usually arguments come after the script name:

vBS = "C:\\Program Files\\nasa\\nmail.vbs"
os.system('cscript "%s" /from:[email protected]
/to:p[email protected] /sub:TEST /msg:hello' % vBS)

But I'd use the subprocess module instead of os.system:

import subprocess
ret = subprocess.call(['cscript', vBS, '/from:...', '/to:...'])

See http://docs.python.org/library/subprocess.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top