Difficulty:
Very Easy
Cost:
Free
Average rating:
Developing console mode application with Delphi is so easy. Console mode application, or command line program, is an application that does not use Windows Graphical User Interface. Most DOS software is command line programs. Creating console mode application has never been so easy. Read these steps to find out how to program a Delphi console mode.
Step 1:

Create a new project. Create a new project from File->New->Others. Select Delphi Projects in the Item Categories list. On the right side, you will see a Console Application item. Select it and click the OK button to create your project.

Step 2:

Notice the code skeleton created. Delphi IDE will create a code skeleton as follows:

program Project1;
{$APPTYPE CONSOLE}
uses
  SysUtils;

begin
  { TODO -oUser -cConsole Main : Insert code here }
end.

Step 3:

Define your code. What you need to do is define your code between begin and end. For example, to output text to standard console, you will want to use the WriteLn() function.

program Project1;
{$APPTYPE CONSOLE}
uses
  SysUtils;

begin
  WriteLn('Hello there. This is my first console mode application');
end.

Step 4:

Save your project. For example, save your project as Hello. To test your application in Delphi IDE, press F9. Delphi automatically builds your project if your application has not been built. You may not read the text outputted on the console because it shows and closes windows quite fast. You can run your application from the command prompt. Go to Start->Run. Type cmd and press the Enter button or click OK. Change the current directory to your project directory, then type Hello and press Enter.

Zamrony P Juhara's picture
About this Author:
Zamrony P Juhara is a Delphi programmer from Indonesia currently living in Surabaya. He is very interested in DirectX programming topics. Currently, he maintains his own website, http://juhara.com, where he posts his DirectX programming articles.
View more information and all guides by Zamrony P Juhara