“This application could not be started.” Only when the file is in system32 directory

后端 未结 5 1094
-上瘾入骨i
-上瘾入骨i 2021-02-13 06:14

I wrote a little piece of software that downloads file from internet, that is, nothing more. My intentions are to use it thru the command line... It works great, but when I plac

5条回答
  •  长情又很酷
    2021-02-13 07:13

    Short Answer: Uncheck "Prefer 32-bit".

    Long Answer: (Not 100% sure but here goes)

    Assuming you have a 64 bit machine, keep in mind that System32 is a folder that is reserved for 64 bit application usage, and although it may seem strange, SysWOW64 contains 32 bit dlls and is reserved for 32-bit applications. Typically, 32-bit applications that access System32 will go through a file system redirector to the SysWOW64 folder. More info here.

    However, when your application (which runs as a 32-bit process) runs in System32 itself, the redirector probably doesn't do anything because it thinks there isn't any need to redirect, which is why your app works outside of System32 but not inside it.

    So to solve this, uncheck Prefer 32-bit so that it will try to target 64 bit platform, ... or better yet, put the app elsewhere and add the application directory to your environment path variable. That way you can still access your application .exe anywhere, and it won't pollute your System32 folder which should only be used for Windows files anyways.

提交回复
热议问题