How To Run A Batch Executable File Using The UiPath Assistant?

How to run a Batch executable file using the UiPath Assistant?

In this example, we will raise a toast notification on the Windows 10 using a PowerShell script inside a .bat file.

Prerequisites for this example:

  1. Administrator privileges is required on the machine to install BurntToast module (designed for Windows toast notification) in PowerShell
  2. In PowerShell as Administrator type this command and accept the installation
  • Install-Module -Name BurntToast

  1. Start -> Notifications & actions settings -> enable Get notifications from apps and other senders
  2. Make sure that in the Get notifications from these senders you allowed UiPath Assistant and Windows PowerShell

The messageTextDisplay.bat file is having these lines of code (in the Command Prompt the System time will be displayed for a period of 5 seconds, and in the PowerShell script, a toast notification will be displayed):

@echo off

echo System time: %DATE% %TIME:~0,5%

powershell -Command "&{[string]$varTime = Get-Date -DisplayHint Date; Import-Module BurntToast; New-BurntToastNotification -AppLogo robot_icon.png -Text $varTime, 'Your script ran successfully, celebrate!';}"

timeout 5 > NUL

In Studio, in order to run the .bat file, specify the full path of the application executable to be opened in the FileName argument in the Properties panel for the Start Process activity.

Example (in this case the .bat file is in the same place as the Studio project):


Example of running the process from Assistant:


If the .bat file 'invisible' needs to be executed without opening the Command Prompt, use a .vbs file that has these line codes and use it in the Start Process activity:

Set WshShell = CreateObject("WScript.Shell")

WshShell.Run chr(34) & "messageTextDisplay.bat" & Chr(34), 0

Set WshShell = Nothing

Example of running the process from Assistant: