Skip to content

Execute third-party program from .NET

Fredrik Roaldset

Asked Jan 4, 2006, 11:46 PM EST2 answers
Share
LinkedInX
Hello

I am developing a program that at one point needs to generate and open an excel file from a crystal report. It was fairly straight-forward to generate the excel file, but I am having trouble finding anything about initiating the excel-application from my C#.NET code.

Preferably, I'd like to open excel as a stand-alone application on the side rather than incorporating it into the form, though that too is an option. So is there a way to run dos commands from C# or the .NET framework?

So if anyone knows how to do this or at least point me in the right direction, that'd be great.

Thanks,
Fred

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi

    To execute dos commands I suggest that you write out a .bat file from your C# program. Then you can execute the .bat file by creating and Process object.

    Example of running the .bat file
    private Process prcFTP = new Process();

    prcFTP.StartInfo.FileName = "C:\\filename.bat"; 
    prcFTP.Start(); // run the file

    Hope this helps for the dos commands!

    Regards
    Louis

    0
  • 1 short reply
    • 0
      Thank you. That's perfect.
      0