AUTOEXEC.BAT is good for permanent, system-wide settings, but for compilation we only need a short-term, temporary solution.
The batch file I posted must be run from the QB64PE directory or from the MinGW directory. This fact could be changed with a small modification to put QB64PE's location into the batch file. My concern was to make the batch file "just work" without too much customization.
The batch file DOES set the path before running the compiler, even though setting the path for GCC is NOT mandatory. The batch file determines where GCC.EXE is located and could call the compiler directly if we wanted it to. GCC knows where its own files are located relative to itself, so GCC does not actually need the PATH.
The PATH and environment variables can be set at ANY time before running the compiler. That setting does not need to be permanent or system-wide.
The PATH can be set "on the fly" from the command prompt, either by typing or by using a batch file such as this one, which sets the PATH variable then opens a command prompt:
All of the changes made by this batch file will be forgotten by Windows when the command prompt is closed and this file terminates.
I currently have 18 compilers and interpreters ready for immediate use, with many more available if needed. Imagine how long and confusing my PATH would be if I added ALL of those directories to it.
![[Image: 2024-04-20-163354.jpg]](https://i.ibb.co/Dt6HkCY/2024-04-20-163354.jpg)
(I guess I'm a language hoarder.)
Each of these compilers has batch files which set the PATH and other environment variables only when needed. Then, when the compiler is finished and the batch file ends, Windows forgets all of those changes.
Many years ago I created similar batch files for Quick C, Turbo C, Small C, DeSmet C, and any other compiler that I found myself using.
Here is a batch file I wrote to compile programs using Quick C:
(AUTOEXEC.BAT not needed. This batch script uses hard-coded full paths to QC, so it can be run from anywhere. Before this script terminates it resets the path back to its original value, since the DOS command prompt never closes and path changes are not forgotten until reboot.)
When I started using Windows I was so weary of creating so many batch files that I wrote a program generator that can create many batch files from one .INI file.
It's all quite clean, simple, and very functional.
The batch file I posted must be run from the QB64PE directory or from the MinGW directory. This fact could be changed with a small modification to put QB64PE's location into the batch file. My concern was to make the batch file "just work" without too much customization.
The batch file DOES set the path before running the compiler, even though setting the path for GCC is NOT mandatory. The batch file determines where GCC.EXE is located and could call the compiler directly if we wanted it to. GCC knows where its own files are located relative to itself, so GCC does not actually need the PATH.
The PATH and environment variables can be set at ANY time before running the compiler. That setting does not need to be permanent or system-wide.
The PATH can be set "on the fly" from the command prompt, either by typing or by using a batch file such as this one, which sets the PATH variable then opens a command prompt:
Code: (Select All)
@echo off
REM Must be run from the QB64PE directory.
SETLOCAL ENABLEEXTENSIONS
if not "%MGWDIR%"=="" goto bermuda
if not exist "%~dp0internal\c\c_compiler\" echo MinGW subdirectory not found. & pause & goto bed
set MGWDIR=%~dp0internal\c\c_compiler
set PATH=%MGWDIR%\bin;%PATH%
:bermuda
start "%ComSpec%"
:bed
I currently have 18 compilers and interpreters ready for immediate use, with many more available if needed. Imagine how long and confusing my PATH would be if I added ALL of those directories to it.
![[Image: 2024-04-20-163354.jpg]](https://i.ibb.co/Dt6HkCY/2024-04-20-163354.jpg)
(I guess I'm a language hoarder.)
Each of these compilers has batch files which set the PATH and other environment variables only when needed. Then, when the compiler is finished and the batch file ends, Windows forgets all of those changes.
Many years ago I created similar batch files for Quick C, Turbo C, Small C, DeSmet C, and any other compiler that I found myself using.
Here is a batch file I wrote to compile programs using Quick C:
Code: (Select All)
@echo off
if not "%QUICKC%"=="" goto bermuda
set QUICKC=c:\prog\qc
set OLDPATH=%PATH%
set PATH=c:\prog\qc\bin;%PATH%
set LIB=c:\prog\qc\lib
set INCLUDE=c:\prog\qc\include
:bermuda
qcl.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
set %PATH%=OLDPATH
set OLDPATH=
When I started using Windows I was so weary of creating so many batch files that I wrote a program generator that can create many batch files from one .INI file.
It's all quite clean, simple, and very functional.