Where can I set path to make.exe on Windows?

C++RegistryMakefilePathMsys

C++ Problem Overview


When I try run make from cmd-console on Windows, it runs Turbo Delphi's make.exe but I need MSYS's make.exe. There is no mention about Turbo Delphi in %path% variable, maybe I can change it to MSYS in registry?

C++ Solutions


Solution 1 - C++

The path is in the registry but usually you edit through this interface:

  1. Go to Control Panel -> System -> System settings -> Environment Variables.
  2. Scroll down in system variables until you find PATH.
  3. Click edit and change accordingly.
  4. BE SURE to include a semicolon at the end of the previous as that is the delimiter, i.e. c:\path;c:\path2
  5. Launch a new console for the settings to take effect.

Solution 2 - C++

Here I'm providing solution to setup Terraform environment variable in windows for beginners.

  1. Download the terraform ZIP file from Terraform site.
  2. Extract the .exe from the ZIP file to a folder eg C:\Apps\Terraform copy this path location like C:\Apps\terraform\
  3. Add the folder location to your PATH variable, eg: Control Panel -> System -> System settings -> Environment Variables

In System Variables, select Path > edit > new > Enter the location of the Terraform .exe, eg C:\Apps\Terraform then click OK

enter image description here

  1. Open a new CMD/PowerShell and the Terraform command should work

Solution 3 - C++

Or you can just run this PowerShell command to append extra folder to the existing path:

$env:Path += ";C:\temp\terraform" 

Solution 4 - C++

To add a PERSISTENT path (eg one that's permanent), you can do this one-liner in PowerShell (adjust the last c:\apps\terraform part)

Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value  (((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path) + ";c:\apps\terraform" )

Alternatively, you can jump directly to the Environment Variables dialog by RUNning/CMD/PowerShell this:

rundll32.exe sysdm.cpl,EditEnvironmentVariables

enter image description here

Solution 5 - C++

I had issues for a whilst not getting Terraform commands to run unless I was in the directory of the exe, even though I set the path correctly.

For anyone else finding this issue, I fixed it by moving the environment variable higher than others!

Solution 6 - C++

Why don't you create a bat file makedos.bat containing the following line?

c:\DOS\make.exe %1 %2 %5

and put it in C:\DOS (or C:\Windowsè or make sure that it is in your %path%)

You can run from cmd, SET and it displays all environment variables, including PATH.

In registry you can find environment variables under:

  • HKEY_CURRENT_USER\Environment
  • HKEY_CURRENT_USER\Volatile Environment
  • HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questiond9kView Question on Stackoverflow
Solution 1 - C++Natalie AdamsView Answer on Stackoverflow
Solution 2 - C++24x7Cloud ServicesView Answer on Stackoverflow
Solution 3 - C++Mladen MilunovicView Answer on Stackoverflow
Solution 4 - C++KERRView Answer on Stackoverflow
Solution 5 - C++Alex ThomasView Answer on Stackoverflow
Solution 6 - C++Remus RigoView Answer on Stackoverflow