Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

Harbour Shell / Script Runner 3.2.0dev (r2013-04-03 03:33)
Copyright (c) 2007-2013, Viktor Szakats
Copyright (c) 2003-2007, Przemysław Czerpak


hbrun <file[.hb|.prg|.hrb|.dbf]>|<option> [<parameter[s]>]


hbrun is able to run Harbour scripts (both source and precompiled), and it also features an interactive shell prompt.

Options below are available on command-line:

  • --hb:debug enable script debugging

  • -help this help

  • -viewhelp long help in text viewer

  • -longhelp long help

  • -longhelpmd long help in Markdown format


  • *.hb Harbour script
  • *.hrb Harbour portable binary (aka precompiled Harbour script)
  • hbstart.hb startup Harbour script for interactive Harbour shell. It gets executed automatically on shell startup, if present. Possible locations (in order of precedence) [*]: .\, %APPDATA%\.harbour, <hbrun directory>
  • shell plugins .hb and .hrb plugins for interactive Harbour shell. They may reside in [*]: %APPDATA%\.harbour\
  • .hb_history stores command history for interactive Harbour shell. You can disable history by making the first line 'no' (without quotes and with newline). Resides in [*]: %APPDATA%\.harbour\
  • hb_extension list of extensions to load in interactive Harbour shell. One extension per line, part of line beyond a '#' character is ignored. Alternate filename on MS-DOS: hb_ext.ini. Resides in [*]: %APPDATA%\.harbour\

Predefined constants in sources:

  • __HBSCRIPT__HBSHELL when a Harbour source file is run as a shell script
  • <standard Harbour> __PLATFORM__*, __ARCH*BIT__, __*_ENDIAN__, etc...

Environment variables:

  • HB_EXTENSION space separated list of extensions to load in interactive Harbour shell

Shell API available in Harbour scripts:

  • hbshell_gtSelect( [<cGT>] ) -> NIL
    Switch GT. Default [*]: 'gtwin'
  • hbshell_Clipper() -> NIL
    Enable Clipper compatibility (non-Unicode) mode.
  • hbshell_include( <cHeader> ) -> <lSuccess>
    Load Harbour header.
  • hbshell_uninclude( <cHeader> ) -> <lSuccess>
    Unload Harbour header.
  • hbshell_include_list() -> NIL
    Display list of loaded Harbour header.
  • hbshell_ext_load( <cPackageName> ) -> <lSuccess>
    Load package. Similar to #request PP directive.
  • hbshell_ext_unload( <cPackageName> ) -> <lSuccess>
    Unload package.
  • hbshell_ext_get_list() -> <aPackages>
    List of loaded packages.
  • hbshell_DirBase() -> <cBaseDir>
    hb_DirBase() not mapped to script.
  • hbshell_ProgName() -> <cPath>
    hb_ProgName() not mapped to script.


  • .hb, .prg, .hrb or .dbf file passed as first parameter will be run as Harbour script. If the filename contains no path components, it will be searched in current working directory and in PATH. If not extension is given, .hb and .hrb extensions are searched, in that order. .dbf file will be opened automatically in shared mode and interactive Harbour shell launched. Non-standard extensions will be autodetected for source and precompiled script types. Note, for Harbour scripts, the codepage is set to UTF-8 by default. The default core header '' is automatically #included. The default date format is the ISO standard: yyyy-mm-dd. The default GT is 'gtcgi', unless full-screen CUI calls are detected, when 'gtwin' [*] is automatically selected (except for INIT PROCEDUREs).
  • You can use key <Alt+V> in interactive Harbour shell to paste text from the clipboard.
  • Values marked with [*] may be host platform and/or configuration dependent. This help was generated on 'win' host platform.


This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
their web site at http://www\.gnu\.org/\)\.

License extensions:
- This source code must be kept and distributed as part
of the Harbour package and/or the placement of the tool sources
and files must reflect that it is part of Harbour Project.
- Copyright information must always be presented by
projects including this tool or help text.
- Modified versions of the tool must clearly state this
fact on the copyright screen.
- Source code modifications shall always be made available
along with binaries.
- Help text and documentation is licensed under
Creative Commons Attribution-ShareAlike 3.0:


  • Viktor Szakats (