Monday, September 3, 2018

Executing CMD command using Blue Prism | Extracting Password protected ZIP using Blue Prism

There are multiple ways of extracting ZIP file using Blue Prism for example write scripting using VB, C#, J# or using 3rd party tools or running a batch file. Let's try one of the simple methods extracting file.

We are going to run a command in command prompt (CMD) and check the extracted file. Now again there are two ways comes in my mind:


  1. I can open command prompt and send key strokes to run a command.
  2. Execute command by Blue Prism only
In any case if any one sends a key stoke then it is like introducing complexity to you bot like window has to be active and command prompt must at front. To make complexity minimum let do it by second method.

I have taken three variables to store following information and all variables are TEXT type:


  1. ZIP File - "c:\Vaibhav\sample.zip"
  2. Destination Path - "-oc:\Vaibhav"
  3. Zip Command - ""c:\Program Files\7-Zip\7z.exe""


Add an Action Stage in Object Studio and Select "Utility - Environment" Business Object and select Action "Start Process". It requires to arguments to be passed as command which we need to execute and arguments which should be passed with command.



Points to be taken care in above placed information:


  1. Check out the Data Type specified above Zip Command. It contains all text in double quotes while are used two times. This is intentional as when this string must be typed in prompt it must be in quotes as path as spaces in it. 
  2. Make sure while consolidating arguments you must provide spaces between each argument.
  3. Supply Password as an argument (Ideally it must be used as Password datatype but this is for illustration)