ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

How To Compile Pascal Code Using Console (Windows 7)

Updated on March 19, 2013


When I was at school we have been learning Pascal programming language and I faced one problem. Since it was school they didn't introduce us to compiling and other stuff "behind the scenes". We used poorly supported 4-6 years old IDE which was also used in national exams. So my problem was that as technology progressed, 64-bit Windows 7 came to action and our beloved IDE now didn't compile a code on this new Operating System.

Environment Variables
Environment Variables

So what to do?

So if you have faced the similar problem or you just want to learn how to compile without IDE here is what you should do. Go to download and install version of free pascal compiler you need. In my case I need to select Windows 64-bit (in AMD64/x86_64 category).

But sadly that is not all you need to do before compiling. Now we must set PATH so that your Windows knows where your compiler is. To do that Right Click on My Computer and select Properties -> Advanced System Settings (in left panel) -> Advanced Tab -> Environment Variables. Now if you don't see PATH variable like in this picture - you should add one by pressing new. And in variable value put something like this:


It depends on where you have installed your FPC and what version it is.This path should lead to the folder containing "fpc.exe" application. This thing is your compiler. If there was already something in the path variable you should separate them with semicolons.

Get this party started!

So now you can start compiling your .pas files. All you need to do is place them somewhere like "C:/pascal" so that the destination to them is short. Open your command line (console) by writing "cmd" in Start menu search (yeah, that Start in your bottom-left corner). To open your pascal files folder now write "cd C:/pascal". To compile something write "fpc yourProgram.pas". And to open your written program just write "yourProgram.exe".

For editing my programs I prefer notepad++, but you can use any simple text editor. So now you have learned basics of compiling your code, using console and setting the paths. Feel free to ask any questions in comments below.


    0 of 8192 characters used
    Post Comment

    • profile image

      Samuel Santos 3 years ago

      I have the same problem which Edzus , to solve my problem i did!

      in Enviroment System adding a new system variable click add button to create a new variable, name= FPC and value = C:\FPC\2.6.0\bin\i386-win32\ , and works!!!

    • profile image

      Colin Tobing 4 years ago

      It's helpful... thanks a lot man :D

    • heroix profile image

      Mantas Sinkevičius 4 years ago from Vilnius, Lithuania

      You must have set an incorrect PATH variable. You can also try to restart your console, which sometimes might be a case.

    • profile image

      Edzus 5 years ago


      I did all step by step, just changed C:/pascal folder to C:/PASKALS, when i typed fpc myfile.pas, consule said: "'fpc' is not recognized as an internal or external command,

      operable program or batch file."

      What goes wrong? In system settings i wrote like this C:\FPC\2.6.0\bin\i386-win32\ and named that value to FPC.

    • heroix profile image

      Mantas Sinkevičius 5 years ago from Vilnius, Lithuania

      You sure your PATH is correct?

    • profile image

      someone 6 years ago

      I did it just like that and it says no fpc command recognised