Need to pass in a Command Shell Javascript executable into a .NET C# GUI Form. Any ideas where to start?

Posted on 2008-11-05
Last Modified: 2013-12-17
I need to be able to pass in a Command Shell Javascript executable into a .NET, C# GUI Form. Any ideas where to start?
Here's why it needs to be done. When running this tool, called "parseSDLogs.exe", whereby you pass in a number of switches to it (see example below), you are only able to do this for one file at a time.
Here's the syntax usage:
C:\Java>parseSDLOGS.bat -d "\\crprdnsrc03\logs$\sd4\regional" -f "KB958644.log".
Instead of only being able to run this process on one logfile at a time, I need the ability for this executable to run on 2 or more files that will be selected from a list of files in a ListView Form.
Next, the output is outputed like this in the Command Shell after you run it:

C:\Java>parseSDLOGS.bat -d "\\crprdnsrc03\logs$\sd4\regional" -f "KB958644.log"
Starting Script - 11/04/08 14:07:10
Processing files
      Reading file - Total size 87971710 - To be read 15330935
   Total inserts: 17950
Ending Script - 11/04/08 14:24:25

So, I need to be able to capture this Output from the Command Prompt, displayed in a RichTextBox control for each file that is selected from the ListView Control. Finally, for each successful output displayed in the RichTextBox control for each file, I would also like this information written to a logfile for each Selected "log file" from the ListView that this will need to run on.

Can someone give me an idea of which Class/Methods/Properties to use. I'm just not sure which Class to use in order to pass the filename and switches to the parseSDLogs.exe file from the GUI and back to the GUI Control box.

Starting Script - 11/04/08 16:17:23

Usage: parseSDLogs [-f "filename"] [-d "directory"] [-D "Debug Level"] [-z] [-s] [-c] [-t]

	Monitors all the Software Distribution log files for status information

	in the \\Servername\logsshare\SD\regional directory

	-f	filename for a particular Distribution


			All files

	-d	Directory to search for log files



	-D	Sets the Debug level that is printed to the logfile

		Valid levels are


	-z	Forces the script to re-read the log files

	-s	Print progress status to the console

	-c	Configures the script. Will be run automatically if config file is not found

	-t	Tests the database configuration

Open in new window

Question by:wally_davis
    LVL 12

    Accepted Solution

    I would just define a Process Start info then loop through each list item to call the process:

    System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo("c:\\JAVA\\parseSDLOGS.bat");
    System.Diagnostics.Process procStart = new System.Diagnostics.Process();
    forech(ListItem itm in MyListBox.Items)
        string logfile = itm.Text;
        proc.Arguments = String.Format("-d \"\\\\crprdnsrc03\\logs$\\sd4\\regional\" -f \"{0}\"",logfile);
        procStart.StartInfo = proc;
        procStart.WaitForExit = true;

    Open in new window

    LVL 12

    Expert Comment

    I forgot to mention that in the System.Diagnostics.Process you can define where the output is to goto

    Author Comment

    I'll need to test this tomorrow and will get back to you. Thanks!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 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

    17 Experts available now in Live!

    Get 1:1 Help Now