Command line exe not working in windows 7 32 bit system


  • Hi Every one,


    I am using Process start to execute a command line exe in Windows 7 32 bit machine. When I start the process command line window open and exited immediately without throwing any error.

    The same exe is working perfectly on Command window.


    CMD> test.exe backup D:\abc.text E:\xyz.txt.

    The above command execute perfectly on command windows.

    I am using the same commands in my C# code as follows.

    System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = exePath;
    startInfo.Arguments = "/C backup " + textBox1.Text.Trim() + " " + textBox2.Text.Trim();

    System.Diagnostics.Process myProcess = null;

    myProcess = Process.Start(startInfo);

    When the process starts the process will open the exe(command line window is opening) and the window closed automatically without throwing error.

    Could anyone please help me to resolve this issue?


    Sathiya Jeba 

    Monday, January 27, 2014 7:46 PM

All replies

  • Hi Sathiya,

    Try this code:

    System.Diagnostics.Process process = new System.Diagnostics.Process();
    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
    startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    startInfo.FileName = "cmd.exe";
    startInfo.Arguments = "test.exe backup D:\abc.text E:\xyz.txt";
    process.StartInfo = startInfo;

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 28, 2014 5:36 AM
  • Hi Caillen,

    Thanks for your immediate response.

    I have tried the above code. Unfortunately that is not suit my primary requirement.

    test.exe is not executing When I execute the above code, Instead of its opened the command window. 

    But my requirement is test.exe should  be executed as background process.

    Thanks and Regards,

    Sathiya Jeba

    Tuesday, January 28, 2014 2:05 PM