Share via


Redirecting output of Execute Process Task

Can you guess why this does not work?

A customer is trying to use the Execute Process Task to execute the preplog.exe application (Microsoft utility) and pass the following command-line arguments: inetsv1.log > inetsv1.txt.

Expected result: When the package runs, content in the inetsv1.log file is moved to the inetsv1.txt file.

If you need a hint: think about what code parses the redirections characters  > and < and handles the redirection.

The redirections are not part of the OS, they are handled by command shell, under Windows this is usually CMD.EXE. Since SSIS just starts the application itself, all the arguments specified in the Arguments field are simply passed to the program. Neither SSIS nor the program you invoke handles the redirection, so this obviously can't work as expected.

How to make it work? Specify CMD.EXE as your executable and following line as arguments: /C YourApp AppArgs >OutputFile. The arguments are passed to CMD.EXE which runs your command and handles the input/output redirection.

An easier approach might be to put everything in a batch file (.CMD or .BAT) and run this batch file from Execute Process task.

Comments

  • Anonymous
    October 17, 2007
    The comment has been removed