System.ComponentModel.Win32Exception when starting process - file not found, but file exists

后端 未结 1 1535
小鲜肉
小鲜肉 2020-12-20 17:01

I am trying to create a manager for my autostarts. It should read an XML file and then start my programs with a custom delay. For example:



        
相关标签:
1条回答
  • 2020-12-20 17:10

    Clearly you are using a 64-bit version of Windows. The c:\windows\system32 and c:\program files directories are subject to a feature called "file system redirection". It is an appcompat feature, it helps to ensure that 32-bit processes don't try to use 64-bit executables. They'll get redirected to c:\windows\syswow64 and c:\program files (x86).

    So when you try to start a file in c:\program files\realtek\etcetera, your 32-bit program will be redirected to c:\program files (x86)\realtek\etcetera. A directory that doesn't exist, kaboom. Same ingredient for igfxtray.exe

    You'll need to change your program's platform target so it can run as a native 64-bit process and avoid the redirection problem you now have. Project + Properties, Build tab, change the "Platform target" setting to AnyCPU.

    0 讨论(0)
提交回复
热议问题