pascalfreepascalwindows-console

How to execute FreePascal from windows command line as "fpc"


I've noticed at one place that they was able to call FreePascal compiler as "fpc" from windows command line like:

fpc my_program_source.pas

How to achieve this? Is it some command that assigns "command => exeFile"?


Solution

  • Here's what to do:

    1. Find FPC.EXE on your computer. The brute force method would be

      DIR/S C:\FPC.EXE
      
    2. Go to the Windoze Control Panel and find System. Under the Advanced settings you should find a PATH variable.

    3. Modify PATH so that it looks like

      WHEVER-IT-WAS:C:\WHAT\EVER\DIRECTORY\YOU\FOUND\FPC\IN
      

    Add a ":" and your directory.

    1. Open a NEW windoze DOS window

    2. Do

      FPC

    3. If this does not work, type

      ECHO $PATH

    Make sure it has the directory you wanted is there. If not, a reboot might be in order.