newbie - returned values from cscript.exe

Rich richfahey at gmail.com
Wed Jan 24 20:26:09 CET 2007


I am writing my first python script and I'm guessing this is something
obvious but I can't find any examples of doing something like this.  I
have a python script that is running a vbscript through cscript.exe.
The vbscript looks up a server name, username, password etc and returns
these values in a delimited list using wscript.echo.  I can assign
these values to variables using a Windows batch files with the
following code

FOR /F "tokens=1-6" %%a in ('cscript /nologo GetServerAccessInfo.vbs"')
do (
	SET DB_SERVER_NAME=%%a
	SET DB_NAME=%%b
	SET NMDBO_USERNAME=%%c
	SET NMDBO_PASSWORD=%%d
	SET SU_USERNAME=%%e
	SET SU_PASSWORD=%%f

I can't figure out how to do the same thing using a python script to
call this instead of a batch file.

I am running the vbscript by using the following command
os.system('cscript /nologo GetServerAccessInfo.vbs')




More information about the Python-list mailing list