0

I am having an exe file that takes path of an excel file as an input. It generates several splitted excel files as an output. but the output directory needs to be specified where the spliited output files need to be stored. Can any one help me with this.

0

1 Answer 1

1

You can use the Process class to achieve this:

using (p = new System.Diagnostics.Process())
{
    p.StartInfo.FileName = "PathTo.exe";
    // Provide command line argument
    p.StartInfo.Arguments = "arg1 arg2 arg3 \"Arg with whitespace\"";
    // You can also try to set the working directory when you run the process
    p.UseShellExecute = false;
    p.WorkingDirectory = @"C:\OutputDirectory";
    p.Start();
    // In case you want to wait for the process to exit
    p.WaitForExit();
}
Sign up to request clarification or add additional context in comments.

3 Comments

hi, thanks for the answer. Bt i already am getting a window of exe file after passing the args. i just dont knw how to redirect the output of exe to a new directory.
@AnanyaMalik: that depends on the exe file you are calling. Maybe you can change it in the arguments, maybe you can solve it by setting the working directory. I've updated the sample.
Thnx alot. I got it working .. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.