Starting PocketBuilder from a command line

You can start the PocketBuilder executable from a command line to build a workspace without opening the development environment, or to open the development environment with a specific painter or object open. You can also use the Windows Run dialog box to accomplish these tasks.

The general syntax is:

directory\pk20.exe {/workspace workspacepath} {deployoptions | runoptions} {/output outputpath}

where directory is the fully qualified name of the directory containing PocketBuilder.

Table 22-1: General command-line options for PocketBuilder

Option

Description

/W workspacepath

Opens the workspace workspacepath. This option is required for deployment. To open PocketBuilder, the default is the most recently used workspace if you have selected the Reopen Workspace on Startup check box in the System Options dialog box. If you have not selected this check box, you must specify the /W option before specifying any other options.

deployoptions

Options for deploying the workspace. See Table 22-2.

runoptions

Options for opening the development environment. See Table 22-3.

/OU outputpath

Logs the contents of the Output window to outputpath.

NoteShort option names The syntax statements in this chapter show the long form of option names. You need only use the initial letter or letters of the option name as long as the option is uniquely identified, as shown in Table 22-1.

Building workspaces from a command line

The deploy options are deploy, fullbuild, and incrementalbuild. These options must be used with the workspace option.

Table 22-2: Options for deploying a workspace

Option

Description

/deploy

Deploys the workspace and exits

/fullbuild

Fully builds the workspace and exits

/incrementalbuild

Incrementally builds the workspace and exits

You need to create projects and specify build and deploy options for the workspace in PocketBuilder before you start a build from the command line. Deploy builds the projects in the target in the order listed on the Deploy page of the target properties dialog box.

When you deploy or build a workspace from a command line, PocketBuilder starts, completes the build, and exits as soon as the operation is completed. To retain a log file for the session, you can send the contents of the Output window to a file.

This example assumes that the location of the PocketBuilder executable file is in your system path or in the directory from which you enter the command. It opens the workspace called CDShop, builds and deploys the targets in the workspace according to your specifications in the workspace and target properties, records the content of the Output window in the file D:\tmp\cdshop.out, and exits PocketBuilder:

pk20 /w D:\CDShop\CDShop.pkw /d /out D:\tmp\cdshop.out

Starting PocketBuilder with command-line arguments

When you start PocketBuilder from a command line, you can optionally open a workspace, target, and/or painter. These are the painters and tools you can open:

You can also add options to the command line after /painter paintername to open a specific object or create a new one:

{/target targetpath} {/painter paintername} {/library libraryname} {/object objectname} {/inherit objectname} {/new} {/run} {/runonly} {/argument arguments}
Table 22-3: Options for opening the development environment

Option

Description

/T targetpath

Opens the target in targetpath.

/P paintername

Opens the painter paintername. The default is the window that displays when you begin a new PocketBuilder session.

The painter name must uniquely identify the painter. You do not have to enter the entire name. For example, you can enter q to open the Query painter and datab to open the Database painter. If you enter the full name, omit any spaces in the name (enter UserObject, for example).

The painter name is not case sensitive. To open the file editor, you could set paintername to FI or fileeditor.

Except for the /W, /T, and /L switches, switches must follow /P paintername on the command line, as shown in the examples after the table.

/L libraryname

The library that contains the object you want to open.

/O objectname (or /OBJ objectname)

The object, such as a DataWindow object or window, you want to open.

/I objectname

The object you want to inherit from.

/N

Creates a new DataWindow object.

/R

Runs the DataWindow object specified with /O and allows designing.

/RO

Runs the DataWindow object specified with /O but does not allow designing.

/A arguments

Arguments for the specified DataWindow object.

Examples

The following examples assume that the location of the PocketBuilder executable file is in your system path.

This example starts a PocketBuilder session by opening a new window (a window object is not specified) in the Window painter for the Client PKL in the Math workspace. The output of the session is sent to a file called math.log. The workspace file, the PKL, and the log file are all in the current directory:

pk20 /w Math.pkw /l Client.pkl /p window /out math.log

Enter this command to start PocketBuilder and open the DataWindow object called d_emp_report in the workspace Emp.pkw:

pk20 /w D:\pkws\Emp.pkw /P dataw /O d_emp_report