cafex - Run Cafe Applications


cafex [<options>] [<command>] [<arguments>]


-q The command will be executed, and cafex returns immediately. No output is collected.
-o <filename> All output is redirected to the specified file.
-I <encoding> The encoding for the console standard in. Valid encoding arguments are: codepage (e.g. 65001, 932, etc), or the encoding name (e.g. UTF-8, shift_jis, etc). This setting overrides the CAFEX_STDIN_ENCODING environment variable.
If the environment variable and this switch is not provided, the default Windows encoding is used.
-O <encoding> The encoding for the console standard out. Valid encoding arguments are: codepage (e.g. 65001, 932, etc), or the encoding name (e.g. UTF-8, shift_jis, etc). This setting overrides the CAFEX_STDOUT_ENCODING environment variable.
If the environment variable and this switch is not provided, the default Windows encoding is used.
-noinput Disables reading of the PC keyboard or STDIN if redirected.
Setting the environment variable NO_CONSOLE=1 has the same effect.
-h Provides information on valid arguments for each command


Mastering-related commands (makemaster, makeaoc, makedisc, makedownload) have been removed from cafex. These features are now provided by makecfmaster. For more information, see makecfmaster.

The cafex tool is a .NET application that executes Cafe applications without using Cygwin. This tool is the first stage in an effort to eliminate dependency of the Cafe SDK on Cygwin.

The cafex tool can be used in the following scenarios. The first scenario is the usage of the cafex commands directly. In this scenario, Cygwin is not required and cafex works as an independent Cafe tool. In the second scenario, a requirement may exist to use older bash scripts to provide compatibility with your scripts or build infrastructures. In this second scenario, using cafe.bat along with USE_CAFEX=1 invokes cafex wherever possible and provides legacy Cygwin-based operations but with cafex's faster execution.

To use cafe.bat with USE_CAFEX=1, invoke a Cafe Cygwin shell via cafe.bat and at the prompt type:

$ export USE_CAFEX=1

cafex Supports the Following Commands:

cafex Command Maps to Cygwin Command
cafex run caferun
cafex stop cafestop
cafex discrun cafediscrun
cafex headlessrun cafeheadlessrun
cafex update cafeupdate
cafex on cafeon
cafex install cafeinstall
setbootmode.bat source setbootmode
cafex syncsession syncsession

Parameters for each command are the same as for the corresponding bash script in the Cafe SDK. For more information, see the corresponding script's MAN page in the Cafe SDK.


Microsoft .NET

cafex relies upon the Microsoft .NET Framework 3.5 Client Profile.

Standard Edition of Windows 7 already includes .NET 3.5.

Environment Variables

Using cafex

Open a Windows CMD shell and run either cafex_env.bat or cafe.bat -nocygwin, according to your development environment. See cafe.bat for a full list of environment options.

After cafe.bat or cafex_env.bat have opened, ensure that the Current bridge and Bridge IP Addr fields are configured for your CAT-DEV. If they are not, use setbridge.bat to initialize these variables. From the Windows CMD shell type:

setbridge.bat -default [name] [ip address]

This will initialize the Current bridge and Bridge IP Addr fields, which are mapped to the BRIDGE_CURRENT_NAME and BRIDGE_CURRENT_IP_ADDRESS environment variables.

For more information, see CAT-DEV QuickStart Guide.

Input/Output Encoding

cafex has two options for encoding how the user sends and receives data to the terminal. By default, cafex will use the encoding specified by the operating system. The -I option specifies the codepage to use when sending input into the terminal. For instance, if a terminal requires an input of UTF-8, then the user should specify a value of either UTF-8 or 65001. Similarly, the -O option controls the encoding of the output to the terminal. For example, if an application outputs Japanese characters, the output codepage may need to be set to either shift-jis or 932.

Additionally, applications running on Cafe may output non-UTF-8 data, based on the encoding of the source files. Note that all of the SDK demos use UTF-8 as their encoding. If the strings in a Cafe application are not UTF-8, the user will need to define/adjust their LANG environment variable in the Windows CMD shell. For Cygwin users, LANG is already defined, so no work needs to be performed unless the application outputs strings with a different encoding. In Windows, use the following syntax to set LANG:

set LANG=<language>_<territory>.<charset>

Encoding Example

A Japanese user who wants to use Shift_JIS encoding would set their LANG to ja_JP.SJIS:


Then they would run the following command line:

cafex -O 932 run application.rpx

CafeX Encoding Diagram

See Also

Running Applications Overview
cafex cleardata
cafex launch
cafex recover
cafex revert
cafex version

Revision History

2015/07/09 Added links to install command.
2014/09/23 Placed topic in canonical API format.
2014/05/14 Removed mastering commands, as that is now a separate executable.
2014/02/24 Added description about makecfmaster.exe.
2014/02/19 Replace refs to multi_cafe.bat.
2014/01/31 Added version command.
2014/01/28 Added run -K command.
2014/01/20 Added revert command.
2014/01/14 Changed setbootmode script-equivalent.
2013/12/04 Added launch command and -noinput option.
2013/11/11 Added headlessrun command.
2013/09/03 Added information about how LANG affects output from Cafe
2013/08/01 Added information about encoding options
2013/07/29 Mastering tools cleanup.
2013/07/24 Added syncsession, recover and cleardata commands.
2013/07/18 Added encoding commands.
2013/06/11 Added new mastering commands.
2013/05/08 Automated cleanup pass.
2013/03/13 Update links; editorial changes.
2013/01/15 Updates to requirements and using cafex sections. Added command mapping section.
2012/04/05 Initial version.