cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LanceKemp
Regular Visitor

Power Automate Basic...How to launch and run a desktop flow from a Batch or Command File?

Need the ability to use the free version of Power Automate and have it lauched from either a .bat or .cmd file and start a desktop flow automatically without user intervention.... CAN THIS BE DONE?

 

(with out paying $100 a month )

18 REPLIES 18
Highboy
Super User
Super User

I don't think so.

VJR
Super User
Super User

There are multiple suggestions on this topic in the Ideas section. You can search and upvote them.

PAG
Resolver I
Resolver I

Hello @LanceKemp 

Yes, this is already possible. Here is a working example: https://power.automate.gallery/run-flow-from-command-line-prompt-or-windows-task-scheduler 

LanceKemp
Regular Visitor

Resolver 1-

 

I appreciate the help, but, I'm new to this and I can see you can run a "ping" command from a task or cmd file.  but I am not sure how these steps would work for me.  I am trying to launch a premade flow called "Totalizer Login" that works from within Power Automate.  But I can't seem to get Power Automate started and then automatically run the flow from the Windows Startup menu or even from a command prompt.  Once Power Automate starts from a Batch, or CMD file, how do you force it to run an existing flow.?

Hello,

Sure, I'll explain. Add this action as the first action to your flow "Totalizer Login":

WAIT (System.WaitForProcess.ProcessToStart ProcessName: $'''PING''')

 Then run the flow. Flow will not complete, it will wait instead.

Next, use command prompt to complete the flow, open command prompt and type (you could also run this from a .bat file):

ping localhost -n 1 > NUL

Your flow will now complete.

You can improve this solution by adding an infinite loop to the flow (see my example link).

Hi, I have a question regarding this issue. I have this whole chunk of code in PAD where I have to run everyday. So I plan to put it inside the windows task scheduler. However, just from your code, may I ask

1) what is the purpose of the label there

2) where do i insert this inside my pad desktop flow?

 

This image shows how my flow starts and what i tried and there is a total of 1219 Actions. I have yet to tried if it works as i have to wait till tomorrow before seeing, but please tell me if i am doing it correctly or wrongly:

Alphadrag_1-1657079176358.png

 

 

Hello @Alphadrag 

1) what is the purpose of the label there

The purpose is to create an endless loop. Without the label, your flow would just run once.

 

2) where do i insert this inside my pad desktop flow?

Insert "LABEL Restart" at the top, before "WAIT". Insert "GOTO Restart" as the last action in your flow, where the flow ends.

Thank you for your reply. However, I have a question here:

 

If my power automate desktop app is not open, would the task scheduler still work and run that particular desktop flow named "Backup_Tracking_RPA"? or how does it exactly work? Because ultimately I want this flow to be run daily using task scheduler, without having the need for me to open up the application as sometimes I won't be around to open the application and run the flow. 

The flow will not run if it have not been started beforehand.

You might want to use the new feature "Run through an external link", then you don't need to start the flow beforehand. I've updated the example at: https://power.automate.gallery/run-flow-from-command-line-prompt-or-windows-task-scheduler 

But that is a premium feature correct? Which i do not have. So what i need to do is just start running the flow before hand correct? and it does not matter if i close the app after running the flow as it will continue to run unless stopped is it?

 

 

But that is a premium feature correct?

Yes, that is a premium feature.

 

So what i need to do is just start running the flow before hand correct? and it does not matter if i close the app after running the flow as it will continue to run unless stopped is it?

You need to start the flow AND keep the flow running. You may close the application since flows will continue running in the background. Without the premium plan, you need to keep the flow constantly running on your computer, that's the drawback.

Ah i see, i got a final question. what program/script does the ping run in for the edit actions? is it a cmd command?

 

Yes, ping will be executed in Command Prompt (cmd)

Besides ping, what else can i use? as i require to use the normal commands like ping/netstat/ipconfig etc. I need to use cmd commands that are less used. Do you have any on mind?

Tested quickly and also these native commands works:

  • ipconfig
  • tracert
  • nslookup localhost (use "nslookup" in "wait for process")

are there any others? any commands not related to networking and less known and works?

LogicSmith
Helper IV
Helper IV

Basically, you can create or use any app to trigger this - the trigger just loops and looks for a program to run with a particular name. If you have a developer handy, ask them for a console app that immediately exits. You should get a tiny EXE which you can rename to whatever you want. As long as its name matches the name you're looking for in the loop.

No need to consult a developer. I created a Windows application (EXE) that you can download and use right away, just for this purpose. Please follow instructions. See section "Run with parameters" at https://power.automate.gallery/run-flow-from-command-line-prompt-or-windows-task-scheduler 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Top Kudoed Authors
Users online (4,923)