I use VS Code with MinGW for C++ programming and recently configured Anaconda as the Python interpreter. After switching back to C++, PowerShell began reporting that profile.ps1 could not be loaded because script execution was disabled, and Conda activation also started causing problems. I temporarily switched the integrated terminal to Command Prompt, but then the C++ Run button and debugging behavior changed as well. I started seeing pre-launch task failures, exit code -1, and programs launched by VS Code that seemed to exit immediately instead of waiting for cin input. Running the executable manually with .\program.exe works correctly. I have already reinstalled VS Code and separated my Python work into Anaconda and Jupyter, but I still cannot get my MinGW and PowerShell workflow working normally. Do I need to remove configuration folders or reinstall everything from scratch?
3 Answers
Reinstalling VS Code alone may not remove your user settings. For a genuinely clean reset, close VS Code and rename or remove its configuration directories, such as %APPDATA%\Roaming\Code, %USERPROFILE%\.vscode, and, if present, %USERPROFILE%\.vscode-shared. Then reopen VS Code and configure only the C++ extension and MinGW first.
Keep the Python and C++ projects in separate VS Code workspaces. Workspace-specific settings can select the correct interpreter, terminal, debugger, and build tasks without Conda modifying the C++ environment. Temporarily disable Python, Pylance, Conda, and other unrelated extensions while testing. For the C++ Run button, check tasks.json and launch.json: make sure the pre-launch task finishes successfully, the debugger uses the current executable, and the program is launched in an integrated or external console that supports interactive input. If manual execution works, the compiler and executable are probably fine; the problem is likely the VS Code task or launch configuration.
I moved the Python work to a separate Anaconda/Jupyter setup and disabled the Python extensions, but even a simple cout program does not behave correctly from the Run button. I will recreate the C++ build and launch configuration instead of reinstalling everything immediately.
Check the execution policy in PowerShell with Get-ExecutionPolicy -List. If the CurrentUser policy is Restricted, your PowerShell profile cannot load. A safer common setting is RemoteSigned: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned. Avoid changing the policy globally unless you understand the security implications.
RemoteSigned is generally preferable to Unrestricted because locally created scripts can run while downloaded scripts still need to be signed or unblocked.

Renaming the Code folder fixed the PowerShell warning, but the Run button still launches the executable without allowing input. Running .\ANDSorting.exe manually works.