Batch File Startups & Shortcuts

There are a number of options that you can use when starting tools. WorkBench for example can be started connecting to a specific CDS. Sometimes, specific environment variables must be set. This is where using a Windows batch file startup is useful.

Windows Batch Files

A batch file is a short script, a list of commands that are run as if you had executed them from the command line. It could be that you want to connect to a company driver, run WorkBench and then exit. You may want to run a specific query on a specific project with the UI in a particular language.

batch file content
Command Batch Files

Examples

Run WorkBench in English connecting to a particular server.

@rem starting Cradle WorkBench in English on UK_3SL_07 server
set CRADLE_UI_LANG=en_gb
start "Cradle WorkBench" "%CRADLEHOME%\bin\exe\windows\work.exe" -cds UK_3SL_07

Or you can run WorkBench, with the company documents drive connected.

rem starting Cradle WorkBench with documents drive
echo Mapping network drive...
net use z: \\UK_3SL_07\company
if errorlevel 1 (
echo Unable to use shared folder \\UK_3SL_07\company
echo Quitting!
exit /b
)
"%CRADLEHOME%\bin\exe\windows\work.exe"
net use z: /delete

You can even, run WorkBench, logging in and showing a query with a French UI.

@rem starting Cradle WorkBench in French and run query
set CRADLE_UI_LANG=fr
start "Cradle WorkBench" "%CRADLEHOME%\bin\exe\windows\work.exe" -action queryrun -query "Design - linked Test" -qloc project -login NISHMA,nishma,WOSY

Once you save the batch file, you can execute it from the File Manager, or a Shortcut, or as we’ve illustrated by double clicking the icons on the desktop.

Shortcuts

Windows desktop shortcuts can be created to directly run WorkBench. You’ll be able to set all the command line options, but won’t be able to do anything like connecting a drive.

Simply drag the WorkBench icon from the WindowsStart menu‘ onto your desktop. Right click and select Properties then add any options to the command line in the Target field. This example shows how we log into the DEMO project really quickly.

running WorkBench from a shortcut
WorkBench shortcut

Command Line Options for WorkBench

If you run WorkBench from the command line with a -help option,

C:\”%CRADLEHOME%\bin\exe\windows\work.exe” -help

you’ll be shown all the values that can be entered into a command line call.

list of command line options for WorkBench
WorkBench Command Line Options
usage: work.exe [options]
options are:
   [-cds]
   [-display ]
   [-login ,,]
   [-noldap]
   [-nobanner]
   [-ro]
   [-action {itemview | queryrun}]
   for itemview:
      -pduid [-version ] [-draft ]
      [-form -floc ]
   for queryrun:
      -query -qloc
      [-view -vloc ]
   where loc is one of:
      system automatic project usertype team user personal
   [-errorstack]
   [-ver]
   [-help]

These values can be used in a direct shortcut , or in the command entered into he batch file.