Execute DOS Command in Desktop flow using Microsoft Power Automate

Microsoft Power Automate is a software by Microsoft for the automation of recurring tasks. It is part of the Microsoft Power Platform line of products together with products such as Power Apps and Power BI. More Details https://powerautomate.microsoft.com/en-us/

Desktop flows are the existing robotic process automation (RPA) capabilities in Power Automate and enable to automate of all repetitive desktop processes.

Scripting actions enable you to run blocks of code and implement custom behavior in your desktop flows. All scripting actions follow the basic structure of the respective programming or scripting language: PowerShell, Python, DOS Command, VBScript, and JavaScript.

Using the Dos command action executes a DOS command or console application in invisible mode and retrieves its output upon completion.

Reading this article, you can learn how to Execute the DOS Command using Run Dos command actions with the Desktop flow in Microsoft Power Automate.

The following important tools are required for developing Microsoft Power Automate,

  1. Windows 10/11 (Recommended)
  2. Power Automate Desktop - Download the Power Automate installer

Now we can discuss step-by-step App development.

Step 1. Open Microsoft Power Automate ->  New Flow. Next, Give the Flow name as PADDos, Click the Create button,

DOS Command in Desktop Flow

After that, we are able to see the Desktop flow,                                              

DOS Command in Desktop Flow

Step 2. For Testing the Run Dos command action in Scripting actions,

Add the Run Dos command action, and Set the DOS command or application parameter as “Dir” and Working folder parameter as <File Path> and the following variables produced automatically, For output CommandOutput variable and CommandErrorOutput variable for errors that may occur during the execution of the Command.

DOS Command in Desktop Flow

For Displaying the Run Dos command Output, Add the Display message action, Set the Message box title Parameter value as  “DisplayDos”, and Message to display Parameter value as

  • %CommandOutput%
  • %CommandErrorOutput%

and Click the Save Button.

DOS Command in Desktop Flow

Now, Save the PADDos Desktop Flow,

DOS Command in Desktop Flow

Step 3. Now we can run your PADDos Desktop Flow in Microsoft Power Automate, 

The output of the PADDos,

DOS Command in Desktop Flow

Summary

Now, you are successfully tested the Run Dos command action in Desktop flow – PADDos in Microsoft Power Automate.


Similar Articles