Passa al contenuto principale

Class ConsoleLauncher

Namespace: TecnoPack.Interactivity
Assembly: CO0002_Templ_FlowpackHMI_V00_26_M.dll

Launches a generated batch script via CMD, captures the output from a temporary file, and handles cleanup. The script must use the placeholder #outputFilePath#, which will be replaced with the actual path before execution.

public static class ConsoleLauncher

Inheritance

object ← ConsoleLauncher

Methods

Launch(string, string)

Executes the provided batch script in a temporary folder and returns the user input.

public static string Launch(string tempFolder, string script)

Parameters

tempFolder string

The folder where temporary files (BAT/TXT) will be stored.

script string

The complete batch script content. It should contain the token #outputFilePath# and write user input to %OUTPUT_FILE%.

Returns

string

The captured user input as a trimmed string, or null if an error occurred.

Remarks

The implementation is robust to spaces in paths by quoting all file paths and using redirection with quoted targets.