I have a console application that runs .bat
and .vbs
files.
The method which starts these processes is as follows:
public void runProcess(string aPath,string aName,string aFiletype)
{
string stInfoFileName;
string stInfoArgs;
if(aFiletype == "bat")
{
stInfoFileName = (@aPath + @aName);
stInfoArgs = string.Empty;
}
else
{ //vbs
stInfoFileName = @"cscript";
stInfoArgs = "//B //Nologo " + aName;
}
this.aProcess.StartInfo.FileName = stInfoFileName;
this.aProcess.StartInfo.Arguments = stInfoArgs;
this.aProcess.StartInfo.WorkingDirectory = @aPath;
this.aProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
this.aProcess.Start();
Console.WriteLine("information passed from batch: ???");
this.aProcess.WaitForExit(); //<-- Optional if you want program running until your script exit
this.aProcess.Close();
}
The current .bat
files which it is starting are used to send data over ftp (ftp
, ftps
, or sftp
).
When the process is running all information is shown in the process windows e.g. an error might occur, the file is not transferred and a message detailing this is displayed in this "child" process window. Once the process has finished the "child" window disappears along with the messages.
Can I somehow return this useful information to my main console application window?