Quantcast
Channel: Shavlik User Community : Document List - All Communities
Viewing all articles
Browse latest Browse all 1352

Custom Action - How To Work With Batch Files

$
0
0

Symptoms


When running a batch file as part of a custom action, the deployment never completes/the deployment hangs.

 

Cause


When Protect is running a deployment, it creates a batch file that is copied to the target machine. This batch file contains all the information related to that deployment, including what patches should run, and with what switches. It also includes any Custom Actions that the user defined. This batch file will be refered to as the Protect Generated Batch. When the Protect Generated Batch file is running, it initiates each task sequentially going through the list (one task must finish before the next can begin). When the Protect Generated Batch file calls the users custom batch file, the Protect Generated Batch file waits for the users custom batch file to return an exit code to indicate it is done. If the users' custom batch file is not accessed with an appropriate command, it will not return the necessary exit code for the Protect Generated Batch File to continue through its pending actions.

 

Solution


If the Custom Action batch file is going to run an action that following actions are dependent on (example: batch file stops a service so a custom action can run a .exe), then utilize the CALL command.
The call command will allow the custom batch file to return an exit code to the Protect Generated Batch file so it can continue on its jobs, once the custom batch file finishes.

Example: Call%PATHTOFIXES%Install\stop_services.bat

If the Custom Action batch file is going to present the end user with information that should stay open (example: a custom message that the batch file shows), then utilise the STARTcommand.
The Startcommand will begin the custom batch file, and once it has started, the Protect Generated Batch file will continue without waiting for the custom batch file to close.


Example: Start%PATHTOFIXES%Install\show_warning.bat

 

These are CMD commands, not Shavlik custom variables. More info on CMD commands here: http://ss64.com/nt/

 

Related Documents


Custom Action - Using the Null Patch

 

Affected Product(s)


Shavlik Protect 9.x


Viewing all articles
Browse latest Browse all 1352

Trending Articles