• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

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

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
  KB958644.log
      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.
Regards,
Wallace

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
		Default:
			All files
 
	-d	Directory to search for log files
		Default:
			\\ServerName\logshare\state\city
 
	-D	Sets the Debug level that is printed to the logfile
		Valid levels are
			DEBUG | INFO | WARN | ERROR | FATAL
 
	-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

0
wally_davis
Asked:
wally_davis
  • 2
1 Solution
 
ShazbotOKCommented:
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;
    procStart.Start();
}

Open in new window

0
 
ShazbotOKCommented:
I forgot to mention that in the System.Diagnostics.Process you can define where the output is to goto
0
 
wally_davisAuthor Commented:
ShazbotOK,
I'll need to test this tomorrow and will get back to you. Thanks!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now