Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

¿Cómo puedo ejecutar un script .vbs desde código c#.?

79 views
Skip to first unread message

Miguel Gómez

unread,
Dec 2, 2009, 12:29:13 PM12/2/09
to
Hola a todos:

Pregunta de novato:

�C�mo puedo ejecutar un script .vbs desde c�digo c#.? El script devuelve
valores que escribo en la consola usando "echo". La idea es recuperar esos
"echo's" y guardarlos en una string. Ser�a algo as�:

string[ ] resultado = "Ejecutar .vbs"

El script se ejecutar�a, y los echo's que devuelve, los guardar�a en una
matriz de string.

�Alguna sugerencia?

Desde ya muchas gracias y un saludo.

Miguel

Jani J�rvinen [MVP]

unread,
Dec 18, 2009, 8:19:01 AM12/18/09
to
Hello Miguel,

> �C�mo puedo ejecutar un script .vbs desde c�digo c#.?

I can read a little Spanish, but if you don't mind, I'll reply in English.
Hopefully I understood your question correctly.

If you want to execute a VBS script from your C# application and capture the
output, that is luckily quite easy. See here for a generic solution:

http://channel9.msdn.com/forums/coffeehouse/250664-c-execute-external-app-and-capture-output/

Of course, you need to change the executable name to "cscript.exe" and as a
parameter, specify your VBS scirpt name, possibly with a full path.

Hope this points you to the right direction!

--
Regards,

Jani J�rvinen
C# MVP
Vantaa, Finland
E-mail: ja...@removethis.dystopia.fi
Business: http://www.nimacon.net/
Personal: http://www.saunalahti.fi/janij/


Miguel Gómez

unread,
Dec 18, 2009, 8:40:38 AM12/18/09
to
�Thank you!
It works fine!!


"Jani J�rvinen [MVP]" <ja...@removethis.dystopia.fi> escribi� en el mensaje
de noticias:#jPntS#fKHA...@TK2MSFTNGP06.phx.gbl...

0 new messages