ASP.NET C# Run VBS file

Posted on 2007-08-09
Last Modified: 2013-11-07
Is it possible / does anyone know how in a ASP.NET C# 2.0 page to run a vbs file passing it a value and getting a string back from it?


Question by:Nigel_Taylor
    LVL 65

    Accepted Solution


    I am by NO means a C# programmer (never touched it actually), but, in other languages, you would use a Shell command to execute an external program, so you could try something like this:
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo.FileName="cscript.exe c:\\dotnetstuff\\scrip1.vbs";

    As for retrieving a string back from it, I think you could only do this if you know how to read STDOUT, which cscript will give you, provided that somewhere in the VBScript is a WScript.Echo statement.


    LVL 65

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now