How It Works
Run your flow from Command Line (with or without parameters), Windows Task Scheduler, shortcut keys or by using a URL.
The purpose is to create a flow with an endless loop. Insert LABEL Restart at the top (before WAIT). Insert GOTO Restart as the last action in your flow, where the flow ends.
You need to keep the flow constantly running, that’s the drawback. If you don’t wish to do this, then see example Run Through an External Link. That is a Premium feature and requires a license.
Run From Command Prompt
- Copy and paste the flow Use Command Prompt or Windows Task Scheduler to your PAD, then run the flow.
- Open Command Prompt and type
ping localhost -n 1 > NUL
- Flow runs and restarts.
Run From Windows Task Scheduler
- Copy and paste the flow Use Command Prompt or Windows Task Scheduler to your PAD, then run the flow.
- Create a new Action with Program
ping
and Add arguments localhost -n 1 > NUL
- Schedule task or run manually.
- Flow runs and restarts.
Run With Shortcut Keys
- Copy and paste the flow Use Shortcut Keys to your PAD, then run the flow.
- Press either
Ctrl
+Shift
+A
(run flow 1) or Ctrl
+Shift
+B
(run flow 2).
- Flow runs and restarts.
Run Through an External Link (Premium 👑)
This is a Premium feature, it will require a per user plan license. With this feature, a flow can be run from Command Prompt and Windows Task Scheduler by using a URL. The flow does not need to be started beforehand. If you don’t have a license, then the flow will not simply run at all.
Run With Parameters
It’s not possible to add parameters to a PING command and pass those to a PAD flow. Therefore, we will create a new Windows console application (EXE) and it will start the flow, this way we can pass parameters to our flows. The console application will save the parameter to a file and the file is read in PAD.
- Download RunPADFlow.exe. This console application have been developed just for this purpose. You can also compile the assembly by yourself (see C# Source Code).
- Run RunPADFlow.exe it will create a new file (RunPADFlow.config to current directory) and immediately exit.
- Copy and paste the flow Run With Parameters to your PAD. On flow line 4, select the file RunPADFlow.config that was created in previous step.
- Open Command Prompt and type
RunPADFlow.exe "This is my parameter"
- Flow runs and restarts.
C# Source Code
You could also compile the executable by yourself.
Console application .NET Framework 6.0:
using System.IO;
using System.Text;
using System.Threading;
namespace RunPADFlow;
class Program
{
static void Main(string[] args)
{
// Get current file path
string path = Directory.GetCurrentDirectory();
string fileName = Path.Combine(path, "RunPADFlow.config");
string args0 = args.Length > 0 ? args[0] : "";
// Save argument to file
using (FileStream fs = File.Create(fileName))
{
byte[] info = new UTF8Encoding(true).GetBytes(args0);
fs.Write(info, 0, info.Length);
}
// Without the sleep, the execution is too fast for PAD and the "Wait for process" action will occasitionally fail to start.
Thread.Sleep(10);
}
}
Notes
If your flow does not run, check your firewall and/or antivirus settings to ensure that those are not blocking any ping requests.
See Also
Schedule flows using Power Automate for Desktop