oel_runs_the_world
oel_runs_the_world

Reputation: 103

std::system() not working correctly

If I execute the command "C:\Windows\system32\java.exe" on the commandline I get information about how to use java as it should be. However, when i write a simple c++ program to do the same

#include <iostream>

int main()
{
    std::system("C:\\Windows\\system32\\java.exe");
    return 0;
}

I get the following console output:

'C:\Windows\system32\java.exe' is not recognized as an internal or external command,
operable program or batch file.

I am using the mingw-w64 compiler on windows 10.

Upvotes: 3

Views: 672

Answers (1)

dewaffled
dewaffled

Reputation: 2973

This is compatibility redirection by Windows on x64 systems:

In most cases, whenever a 32-bit application attempts to access %windir%\System32, the access is redirected to %windir%\SysWOW64.

If your console is 64 bit and application built as 32 bit (or vice versa) they'll show content of different system32 directories under same name.

Upvotes: 5

Related Questions