Console application does not automatically open properly from regedit : Basically I have a console application that opens another .exe. That console application works properly when I normally double click on it.

I added the application in regedit: Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run so that it automatically opens with Windows and that .exe is ran automatically. 



I don't have an idea on how to fix this.

```cpp
#include <windows.h>
#include <shellapi.h>
#include <iostream>

using namespace std;

int main()
{
	cout << "Test...\n";
	Sleep(500);
	cout << "Test..\n";
	ShellExecuteA(NULL, "open", "Manager.exe", NULL, NULL, SW_SHOWNORMAL);
	cout << "Test....\n";
	Sleep(500);
	return 0;
}
```

The thing is that the console opens when Windows starts up, but does not open the .exe file, just basically opens and closes. It's like bypasses the "ShellExecuteA"... line, displaying text on console and Sleep(...) works.

NOTE: Keep in mind that, as said above, it WORKS PROPERLY when I manually open this application, the "Manager.exe" opens. BUT I it doesn't work when this code is automatically opened with Windows. Any help?