If you can call it from the OS/shell command line, you can schedule it into your Job2Do batch! Here we try to list some commands, command sequences, short scripts, and command line tools that you may find useful to schedule in a Job2Do batch.  The focus is on Windows, since most experienced UNIX users will already have access to tremendous command line power and be familiar with exploiting it.


This page is a work in-progress.  If you would like to see how to implement a particular job or sequence of jobs, or you know of a useful command line-accessible tool that is not listed here, please send email to, and we will try to list the response here.


These samples are just starting points. Automators should refer to proper scripting manuals to create production-quality job commands and scripts. We avoid listing extremely common and simple commands such as file copy, file move, etc.  These can be looked up online or in any language manual.




Command Links


File Watching


First, try using Job2Do’s built-in file monitor job which is reasonably powerful. Or, using VBScript you could write a very basic file watching script as follows (which could be easily extended to support time out, wildcards, dates, etc.):





perl -e "$|=1; $file='c:/myfile.txt'; while( ! -e $file ){ print \"No file $file. Sleeping...\n\"; sleep 10; } print \"File found!\n\""

mv myfile.txt myfile.`date "+%Y%m%d.%H.%M.%S"`.txt

File Backup/Datestamp


This is trivial on UNIX/Mac:

' get leaf name

filename = wscript.arguments(0)

set fso  = CreateObject("Scripting.FileSystemObject")

leafname = fso.GetFile( filename ).Name


' split leafname at first occurence of period

baselen  = InStr( leafname, "." )

base     = Left( leafname, baselen-1 )

sufflen  = Len( leafname ) - baselen

suff     = Right( leafname, sufflen )


' create datestamp

tmp= now()

yyyymmdd = DatePart("yyyy",tmp) & Right("00" & DatePart("m",tmp),2) & Right("00" & DatePart("d",tmp),2)


' rename file inserting datestamp before first occurrence of period

set fso = CreateObject("Scripting.FileSystemObject")

fso.GetFile( filename ).Name = base & "." & yyyymmdd & "." & suff

cscript c:\vbscripting\datestamp.vbs c:\folder\myfile.txt

Process Killing


Whichever OS you’re working on, you’ll need to be sure you only have a single process with the given image name. On UNIX, use a combination of ps and kill in a shell script (syntax/output of ps is OS-dependent and not presented here). On Windows:

cmd /c "taskkill /IM myprocess.exe /F"



Unix tar and gzip are indispensable tools for archiving and compression. We will not attempt to document these already well-documented tools here. In Windows, an extremely useful open source archiving tool is 7-Zip (http://www.7-zip.org/). 7-Zip can be called from the command line in Windows and has an extensive set of command line options. After making sure that the executable is in the path of the Client machine, you can archive from a command line job such as the following:



7z a -r c:\folder1\myfiles.7z c:\folder2\folder3\myfiles

The commercial tool WinZip© (http://www.winzip.com) also offers command line access.




Job2Do’s plug-in FTP job can handle most simple, non-secure FTP tasks. If you prefer to use command line FTP in a job (either Windows or UNIX/Mac), you first need to create a batch file and then feed this batch file to the FTP executable.  Here’s an example using sftp on UNIX.


Job 1 (“parent” job) - This job creates the batch file to pass to sftp. Notice the embedded newline character after “cd outbound”, which you can type directly into the command text area of the job definition panel:






XL VBA Macro Calling


To call a VBA macro in a Microsoft Excel spreadsheet from Job2Do do the following:


  1. Place the body of the macro or a call to the macro inside the special Auto_Open() subroutine in your spreadsheet.
  2. Pass the name of your spreadsheet to a command line call to Excel.  In this command line, use the /e switch to prevent Excel from showing the startup screen or opening a new workbook.


Assuming you have set up Auto_Open() correctly in your spreadsheet, your command would look like the following. Your full path to the Excel.exe binary may differ. You do not need to quote around spaces in the path:


Shells and Scripting Engines


Each OS, shell, or scripting engine needs to be called differently from within a Job2Do text command. The key point to remember is that in Windows Job2Do calls the OS directly, whereas on UNIX/Mac Job2Do calls the shell that is configured for the Client. Therefore:


On Windows, binaries, assuming they are on your path, can be called directly while all other scripts should be called using the appropriate scripting engine.


On UNIX/Mac, just go ahead and call the command as you would type it in the shell.


Note that plug-in job commands, unlike text commands, will never be handed off to shells or scripting environments, and therefore should not make use of shell or environment variables.


The table below gives a few examples of how to call different targets on Windows:






Windows Links


Free command line scriptable archiver.

Samba Home

Serve up *NIX files on a Windows network.


Perl for Windows.


Resources for scripting Outlook.

Outlook Redemption

Outlook scripting security patch workaround.


Good site for Windows scripting resources.

VBScript Reference

Microsoft’s official reference.

PowerShell Resources

Microsoft’s official site.

On Windows, if you wanted a specific date format, for example YYYYMMDD, you could first create a script just as the following:

Assuming you place the above script into a VBScript file called “datestamp.vbs”, then call from Job2Do’s command line as follows:

echo "cd outbound

get data_file_from_customer.csv" > /tmp/my_sftp_commands.bat

cd /home/user/customer_file_download_area; sftp -b /tmp/my_sftp_commands.bat username@host.acme.com

C:\Program Files\Microsoft Office\OFFICE11\excel.exe /e F:\batch_spreadsheets\myspreadsheet.xls

File Watching

File Backup/Datestamp

Process Killing



XL VBA Macro Calling

Job 2 (“child” job) - This job calls UNIX sftp and feeds the batch file to it. Create a dependency between this job and job 1 (job 2 runs on success of job 1):


Another way to call a macro would be by using a VBScript wrapper to call Excel. However, this method is a little harder to support than the method above, because by using a wrapper you introduce another operating system process. The Excel.exe process will be a child process of the VBScript process, which is the only process that Job2Do will “know” about. Therefore, killing the job from Job2Do would only kill the VBScript process, and you would be left with an Excel “zombie” process on the client machine.


Command Target

Calling Example

(text in Job2Do command field)


Windows Binary

mytool.exe /a /b /c

...where /a /b /c are command line switches. Make sure that mytool.exe is in you path, or use the full path when calling.

DOS Command

cmd /c copy file1 file2

Job2Do does not wrap commands in a shell by default. Calling “cmd /c ...” executes the following command and arguments in a new DOS shell.


cscript myscript.vbs

Generally batch jobs should run in the background, so avoid using wscript.

VBA Macro (in Excel)

excel.exe /e myspreadsheet.xls

See XL VBA Macro Calling below.

Perl Script

perl myscript.pl

Assuming you have installed some version of Perl and placed it in your path.

Or, if you have perl installed, try the command line script below (replace “c:/myfile.txt” with file to watch).  The command below is quoted and escaped for Windows and may need to be modified to run in a specific UNIX shell:






' use first arg as full pathname of a file

fn = Wscript.arguments(0)

Wscript.Echo "Looking for file '" & fn


Set objFSO = CreateObject("Scripting.FileSystemObject")


' loop until file exists

found = 0

While found = 0

   If objFSO.FileExists( fn ) Then

       Wscript.Echo "Found file."

       found = 1


       Wscript.Echo "File does not exist. Sleeping..."

       Wscript.Sleep 5000

   End If



Wscript.Echo "Done."

cscript c:\vbscripting\fileWatch.vbs f:\FileDrop\foo.txt

Assuming you place the above script into a VBScript file called “fileWatch.vbs”, then call from Job2Do’s command line as follows:

Other useful VBScript file manipulation scripts can be found here (external link):







While some of the commands listed below can be performed with Job2Do’s built-in plug-in jobs, the command line jobs below sometimes offer more flexibility for complex custom jobs.


In general, assuming you have the correct shell or scripting engine installed, the code examples below can be cut/pasted directly into the “Command:” text area of your Job2Do job definitions and then modified to your needs. When code should first be placed in a separate script file and then called from the job command, it is noted below.


Disclaimer:  The examples listed here are for informational purposes only. All use of code examples or modified code examples are at the user’s own risk. Sypsoft does not warranty the functionality or correctness of any code provided here.


Buy SSL Certificate