Press the Windows Key, type PowerShell, and open it.
Windows blocks downloaded scripts by default. To temporarily bypass this security check for your current session, copy and paste this command and press Enter:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Download the script and Navigate to the folder where you downloaded the script (usually Downloads) and run it:
cd ~\Downloads
.\add_path.ps1
Close your current PowerShell window FIRST!!, and open a brand new one to apply the changes. Test the compiler by typing:
g++ --version
If you see version details, your compiler is ready to use from any terminal!
In university computer labs, Code::Blocks is often installed by default, but its internal compiler (MinGW) is rarely added to the Windows environment Path. Because of this, you cannot use the compiler outside of Code::Blocks (such as compiling directly from the Windows Terminal, PowerShell, or VS Code).
This script fixes that problem instantly by finding the default Code::Blocks installation path and permanently adding it to your User Level Path—no administrator/system rights required.