I have a batch file which basically downloads a file from a site or returns a error message saying files are not available. I want to execute this .bat file in C#(SSIS script component) and save the file name to a variable(if the file is downloaded) or assign the error message to the variable.
Thank you in advance
You can use the System.Diagnostics.Process to run the Cmd.exe with the /C option. Provide the name of the batch file and your basically there. To ease wrapping the Process creation and capture of std input and output I recommend looking at the ProcessRunner class I put together some time ago. If not at least read through this article on How to use System.Diagnostics.Process correctly.
Additionally, you might look at the ScriptRunner class in the same library which creates a wrapper around running several different types of Windows OS script files.