2

So I have this distro installed for MinGW. And while it works flawlessly, I'm a bit at a loss on how to add it to my path permanently. If anyone could help me understand the batch file and how to (what folders/paths to add) to my PATH, I would appreciate it. (Mainly the C include stuff.)

I am trying to add specifically these batch file locations to my full path so I can use it anywhere, instead of having to run this file everytime. How do I do that? It's installed to: C:\MinGW.

Relevant bat file:

@echo off
if not exist "%~dp0bin\gcc.exe" goto epicfail
if "%X_DISTRO%" == "nuwen" goto :eof
set X_DISTRO=nuwen
if exist "%~dp0git\cmd\git.exe" set PATH=%~dp0git\cmd;%PATH%
set PATH=%~dp0bin;%PATH%
set X_MEOW=%~dp0include;%~dp0include\freetype2
if defined C_INCLUDE_PATH (set C_INCLUDE_PATH=%X_MEOW%;%C_INCLUDE_PATH%) else (set C_INCLUDE_PATH=%X_MEOW%)
if defined CPLUS_INCLUDE_PATH (set CPLUS_INCLUDE_PATH=%X_MEOW%;%CPLUS_INCLUDE_PATH%) else (set CPLUS_INCLUDE_PATH=%X_MEOW%)
set X_MEOW=
goto :eof

:epicfail
color 4f
echo ERROR: You must run %~nx0 from the root of the distro.
echo        Don't copy or move this batch file.
title ERROR
goto :eof
Rivasa
  • 348
  • 3
  • 7
  • 19
  • Use `setx` instead of `set` to permanently modify environment variables. – DavidPostill Mar 07 '17 at 22:52
  • @DavidPostill setx did not work – Rivasa Mar 07 '17 at 23:35
  • It does if you use it properly. You have to restart the `cmd` shell after making the changes ... – DavidPostill Mar 07 '17 at 23:37
  • @DavidPostill I simply subsituted the word set for setx, and it just gave errors such as: ERROR: Invalid syntax. Type "SETX /?" for usage. ERROR: Invalid syntax. Default option is not allowed more than '2' time(s). Type "SETX /?" for usage. – Rivasa Mar 07 '17 at 23:38
  • Then you didn't read the dupe properly. `setx` doesn't use `=` use a space instead., eg `setx PATH %~dp0bin;%PATH%`. See [setx](http://ss64.com/nt/setx.html) – DavidPostill Mar 07 '17 at 23:40
  • "Unlike set, there is no equals sign and the value should be enclosed in quotes if it contains any spaces. Note that variables may expand to a string with spaces (e.g., %PATH% becomes C:\Program Files), so it is best to include quotes around values that contain any variables." – DavidPostill Mar 07 '17 at 23:41

0 Answers0