PipeExec Class
Properties Methods Events Configuration Settings Errors
PipeExec provides an easy way to start and interact with a process over Stdin, Stdout, and Stderr.
Syntax
PipeExec
Remarks
The PipeExec component provides a way to launch a process and then send/receive data to/from the process. To begin set ProcessFileName to the path of the process on disk. Optionally set ProcessArgs and ProcessWorkingDir.
Call StartProcess to start the process. Next set Stdin or call Send to send data to the process. Received data will be provided through the Stdout and Stderr events.
To terminate the process call StopProcess.
Example Code
Pipeexec exec = new Pipeexec(); exec.OnStdout += exec_OnStdout; exec.ProcessFileName = @"C:\Windows\system32\cmd.exe"; exec.ProcessArgs = "/Q"; exec.StartProcess(); exec.Stdin = "dir" + System.Environment.NewLine; while (true) //Wait for output exec.DoEvents(); static void exec_OnStdout(object sender, PipeexecStdoutEventArgs e) { Console.WriteLine(e.Text); }
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
AcceptData | Enables or disables data reception (the Stdout and Stderr events). |
BytesSent | The number of bytes actually sent after an assignment to Stdin. |
EOL | Used to break the incoming data stream into chunks separated by EOL. |
ProcessArgs | The arguments to pass to the process. |
ProcessFileName | The path to the file on disk to execute. |
ProcessRunning | Whether the process is running. |
ProcessWorkingDir | The working directory of the process. |
SingleLineMode | Special mode for line-oriented protocols. |
Stdin | A string of data to be sent over the connected pipe. |
Timeout | A timeout for the class. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting. |
DoEvents | Processes events from the internal message queue. |
GetLine | Gets a line of text from the server. |
Interrupt | Interrupts the current action. |
Send | Sends data over the connected pipe. |
SendFile | Sends the file over the connected pipe. |
SendLine | Sends a string followed by a newline. |
StartProcess | Starts the process. |
StopProcess | Stops the process. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
ReadyToSend | Fired when the class is ready to send data. |
Stderr | Fired when data come in through stderr. |
Stdout | Fired when data come in through stdout. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
LogonType | Specifies the logon type when starting a process as another user. |
Password | Specifies the password when starting a process as another user. |
ProcessId | Returns the Id of the process which was started. |
ProcessStartupFlags | Specifies the flags used when starting the process in Windows. |
ProcessWindowStyle | Specifies the window style when STARTF_USESHOWWINDOW is specified. |
User | Specifies the user when starting a process as another user. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
ProcessIdleEvents | Whether the class uses its internal event loop to process events when the main thread is idle. |
SelectWaitMillis | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |