Script Examples - Intergraph Batch Services - Help

Intergraph Batch Services Help

Language
English
Product
Intergraph Batch Services
Search by Category
Help

A batch job reads a script and performs the instructions in it, using the appropriate shell (the program that runs the instructions in the script). Scripts can take many forms, including .bat files and Perl scripts. A script can also be an executable program (.EXE file) if the queue has no default shell or if the default shell is set to CMD.EXE.

The following example is a .bat script that backs up a directory on the batch server to a shared drive that has been locally mounted from a remote system. To use the script, ensure that a batch queue has been created, enabled, and started, and that the queue's default shell is the cmd.exe program.

REM This script will do the following:
REM
REM 1. Mount the shared drive \\machine\share
REM 2. Copy all files in c:\users\default to the shared drive.
REM 3. Unmount the shared drive.
REM
net use p: \\machine\share
copy c:\users\default\*.* p:
net use /delete p:

The following example is a .bat script that prints all PostScript files in the c:\temp directory on the batch server to a printer on a remote Windows system. To use the script, ensure that a batch queue has been created, enabled, and started; that the queue's default shell is the cmd.exe program; and that the server system has access to the printer on the remote Windows system.

REM This script will do the following:
REM
REM 1. Associate a remote printer on a Windows system
REM (\\machine\printer) with a local printer port.
REM 2. Copy files in c:\temp that end in .ps to the local printer
REM port.
REM 3. Remove the printer association.
REM
net use lpt1: \\machine\printer
cd c:\temp
for %%I in (*.ps) do copy %%I lpt1:
net use /delete lpt1: