none
Process.Start() error: The specified executable is not a valid Win32 application

    Question

  • My code is
    -----
    Process prc = new Process();
    prc.StartInfo.FileName = "excuteFile.exe";
    prc.StartInfo.Arguments = input + " " + output;
    prc.StartInfo.CreateNoWindow = true;
    prc.StartInfo.UseShellExecute = false;
    prc.StartInfo.RedirectStandardOutput = true;
    prc.Start();
    prc.WaitForExit();
    prc.Close();
    -----
    File arguments: excuteFile.exe input.txt output.txt
    My system: Windows 7 Home Premium Edition 64 bits.
    Error: The specified executable is not a valid Win32 application.
    IDE: Visual Studio 2008 Team System.
    It had been run successfully, but since 12 hours ago, when I run it, the error appeared. I read these URL and followed the steps, but, the problem is not solved. http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/80ea9d75-d808-481b-bc1b-b3e56716119c/
    Wednesday, December 07, 2011 4:01 AM

Answers

All replies

  • Try either of below ways

    1. Build your project in x86 mode. You can do it in project properties.

    OR

    2. I think "excuteFile" application uses native 32 bit instructions. So, build "excuteFile" using x86 configuration.


    Please mark this post as answer if it solved your problem. Happy Programming!
    Wednesday, December 07, 2011 6:22 AM
  • What if you specify the full path to excuteFile.exe, and double check that it exists on disk first?
    Wednesday, December 07, 2011 6:46 PM
  • Thanks everyone!

     

    I solved the problem. Just overwrite copy the executeFile.exe, it had been error.

    Thursday, December 08, 2011 1:41 AM
  • Thanks for sharing your solution here.

    And thanks for your understanding and support.


    Best Regards,
    Rocky Yue[MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 08, 2011 8:32 AM