Thursday, June 27, 2019

How to execute Bat file or command line arguments inside a unit test

             Process proc = null;
            proc = new Process();
            proc.StartInfo.WorkingDirectory = @"C:\Driver\NEW2\";
            proc.StartInfo.FileName = "TrxtoHTML.bat";
            proc.StartInfo.CreateNoWindow = false;
            proc.Start();
            proc.WaitForExit();

WorkingDirectory will change the starting location of the CMD.

No comments:

Post a Comment