Windows ShellExecuteEx Failed; code 2 Error. Cannot open .exe

Jamie barnes 0 Reputation points
2025-07-19T14:46:09.37+00:00

I tried to install a .exe file and received the "ShellExecuteEx Failed; code 2". Then noticed it seems to be all .exe files. When trying to run as administrator I get "Windows cannot find '_______'. Make sure you typed the name correctly, and then try again"

I also cannot:

open task manager

open regedit

run command prompt as administrator

open system restore

open device manager

  • I can't to start the computer in safe mode....
  • I cannot delete a folder called IObit

This is Windows 10 64bit

I have tried:

  • Virus & Malware scans (nothing found)
  • Registry fixes via CCleaner

Any help would be majorly appreciated! Been trying to solve this for hours now.

Windows for home | Windows 10 | Performance and system failures
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. HARDCORE GAMES™ 180 Reputation points
    2025-07-19T15:50:39.2633333+00:00

    First CCcleaner is useless

    When I develop with C++ I use system() which is the standard way to spawn a new program.

    0 comments No comments

  2. Kai-H 6,175 Reputation points Microsoft External Staff Moderator
    2025-07-20T05:16:18.4433333+00:00

    Hello, Jamie barnes

    Thank you for your feedback. I understand that you are having trouble executing files. Here are some troubleshooting solutions:

    Hold down the power button on your computer until it shuts down completely.

    Press the power button again to start your computer.

    When Windows starts loading (you see spinning dots or the Windows logo), immediately hold down the power button again to force your computer to shut down.

    Repeat this process 2 to 3 times. Windows will detect the startup failure and automatically enter the blue “Automatic Repair” or “Recovery” screen.

    Once in the recovery environment, you will see a screen titled “Please select an option.”

    On the “Please select an option” screen, choose ‘Troubleshoot’ -> “Advanced options.”

    You now have several available tools. Please try them in the following order:

    In “Advanced Options,” select “Command Prompt.”

    In the black window that opens, type notepad and press Enter. This will open Notepad.

    In Notepad, click “File” -> “Open.”

    In the “Open” dialog box, change the “File type” from .txt to “All files (.)”.

    Now, use the navigation pane on the left to locate your system drive (typically the C: drive, but the drive letter may change in the recovery environment; you can determine this by the folder contents—look for the drive containing the Windows and Users folders).

    Navigate to the C:\Windows directory and locate a file named regedit.exe. Right-click it and select “Run” or “Open.” This should launch the Registry Editor.

    If regedit.exe launches successfully, we can import a repair file. Return to the command prompt window and enter the following commands to create a repair file. Enter each line and press Enter:

     

    echo Windows Registry Editor Version 5.00 > C:\fix.reg

    echo. >> C:\fix.reg

    echo [HKEY_CLASSES_ROOT\.exe] >> C:\fix.reg

    echo @=“exefile” >> C:\fix.reg

    echo “Content Type”=“application/x-msdownload” >> C:\fix.reg

    echo. >> C:\fix.reg

    echo [HKEY_CLASSES_ROOT\exefile] >> C:\fix.reg

    echo @=“Application” >> C:\fix.reg

    echo “EditFlags”=hex:38,07,00,00 >> C:\fix.reg

    echo “FriendlyTypeName”=“@shell32.dll,-10156” >> C:\fix.reg

    echo. >> C:\fix.reg

    echo [HKEY_CLASSES_ROOT\exefile\shell\open] >> C:\fix.reg

    echo @=“” >> C:\fix.reg

    echo. >> C:\fix.reg

    echo [HKEY_CLASSES_ROOT\exefile\shell\open\command] >> C:\fix.reg

    echo @=“\”%1\“ %*” >> C:\fix.reg

    Now, import the newly created registry file. At the command prompt, enter:

    reg import C:\fix.reg

    You should see a message indicating the operation was successful. Close the command prompt and select “Continue” or “Exit and continue to Windows 10.”

    If all of the above methods fail, it indicates that the system is severely damaged. We recommend reinstalling Windows using a USB installation medium.

    How to make clean install of Windows 11 - ARTICLE - Microsoft Q&A

    For file backup, you can refer to the following link:

    [Article] Rescue Files when Windows Won't Start - Microsoft Q&A

    I look forward to your feedback.

    Best Regards, 

    Kai Ho | Microsoft Q&A Support Specialist

    0 comments No comments

  3. Jamie Barnes 0 Reputation points
    2025-07-20T08:27:59.6533333+00:00

    Hey Kai thanks for the help, I tried your suggestion so far but could not import the registry file, I'm not sure what I did wrong. If the image hasn't attached properly the error I got was The specified file is not a registry file. Apologies I'm typing on my phone while in repair

    0 comments No comments

  4. Jamie Barnes 0 Reputation points
    2025-07-20T08:36:29.05+00:00

    1000011387

    0 comments No comments

  5. Jamie Barnes 0 Reputation points
    2025-07-20T08:43:00.4833333+00:00
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.