I'm using a graphical interface in Pascal and I don't want the childprocesses to return ANYTHING back to screen
(so both 1 and 2 (error) should be redirected to nul or to a file when I specify > in my command-string)
Please help me and help me quickly ... This needs to be operational Wednesday 20th June.
Function ShellCommand(Command : String) : Integer;
Redirect : Boolean;
OutputTo : String;
Param : String;
Redirect := (Pos('>', Command) <> 0);
If Redirect Then
OutputTo := ''
OutputTo := ' 1>nul';
Param := Copy(Command, Pos(' ', Command) + 1, Length(Command) - Pos(' ', Command));
Delete(Command, Pos(' ', Command), Length(Command) - Pos(' ', Command) + 1);
Exec(Command, param + OutputTo);
ShellCommand := DosExitCode;