0

I have recently installed MinGW to my computer, to compile and run programs written in c.

Right now I have to manually go to the bin-folder to execute and compile files.

The path is C:\MinGW\bin

Is there a a way to avoid this everytime? I want be able to directly write the commands when I open the command Line.

I tried to follow the Environment Settings on http://www.mingw.org/wiki/Getting_Started

but it does not work at all.

enter image description here

Björn Hallström
  • 3,775
  • 9
  • 39
  • 50

1 Answers1

1

A simple solution would be a small batch script. Create a new batch file with this code:

@echo off
cd C:\MinGW\bin
:loop
set /p var=
%var%
goto loop

Could you show me your user environment variable called "path"? Maybe we will find the error there.

Edit: Create a new environment variable in the upper field (user-environment variables). Enter this in the window which appears.

Name:  PATH
Value: C:\MinGW\bin

This should work.

ThunderStorm
  • 766
  • 8
  • 24
  • I send a screenshot! I'll test the batchfile later on, thanks! – Björn Hallström Sep 01 '13 at 15:24
  • thanks a lot!!! Now I know a bit more about enviromentvariables. But another problem came up: the files are not found if I compile. if I write gcc -o hello.exe hello.c a get the following message: nu such file or directory. so, where should I place the files when compiling? – Björn Hallström Sep 02 '13 at 08:07
  • No problem. :) Place them in the directory where your .exe is. If this doesn't work take a look at this post: http://stackoverflow.com/questions/12919081/gcc-g-no-such-file-or-directory – ThunderStorm Sep 02 '13 at 11:30