2

I wrote a PowerShell script that calls a C# exe file that works no problem on my machine and a couple other machines on our network, but for some reason it won't run on the computer it needs to. This is the error I get when I try and run it. Any ideas on what could be causing this?

Start-Process : This command cannot be executed due to the error: %1 is not a valid Win32 application.

It will run no problem on a couple other machines on the same network no problem, just not on this particular one. Any input would be helpful, thank you!

5
  • 2
    Your C# application was built for Win64 and you're trying to run it on a Win32 version of the OS. 64-bit applications cannot run on a 32-bit OS. Commented May 8, 2015 at 17:03
  • Gotcha. So for it to work on that machine I'm gonna have to write a new version of the C# program? Commented May 8, 2015 at 17:12
  • 2
    No. Compile the same C# program with AnyCPU as the target (or compile it as 32-bit, which will work on both 32 and 64 bit versions of the OS). Commented May 8, 2015 at 17:16
  • I am running this in Visual Studio, how would I do that in there? or do I have to do it through command prompt? Commented May 8, 2015 at 17:20
  • Project->Properties->Build->Platform Commented May 8, 2015 at 17:55

2 Answers 2

3

It sounds like your C# application was compiled as 64-bit, and you're trying to run it on a system with Windows 32-bit. 64-bit applications will not run on 32-bit operating systems.

Rebuild the C# application with either AnyCPU or Win32 as the target platform. You can do this through the Project menu; edit the properties of your application, go to the Build page, and change the Platform in the drop-down list at the top of that page, and then build your project.

Sign up to request clarification or add additional context in comments.

Comments

2

Can't be sure, but I think your app is 64bit compiled, and you're trying to run it on a 32bit machine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.