Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 3oOOZ+3NYchF9cKGhvDH39
Power Automate - Power Automate Desktop
Unanswered

CMD Session does not start

Like (0) ShareShare
ReportReport
Posted on 12 Apr 2021 08:47:42 by 11

Hello, 

I am trying to get a flow to work that uses CMD session. My flow looks like this:

  1. Open CMD session
  2. Write to CMD session
  3. Read from CMD session
  4. If CmdOutput contains String then do stuff

All is working as expected when I start my flow from the edit window. However, when I execute the exact same flow from the main (or overview) window (first window you see when PAD is started) it doesn't work, even after the computer has been restarted.

 

I tried the following: 

  • added on error behaviour on each of the CMD lines (try again 2 times after 2 seconds) 
  • added a check if CmdOutput is empty and if it is, run the CMD lines again (with reference and goto)

More infos that might be helpful:

  • PAD Version 2.5.39.21056
  • PAD is currently in German language
  • OS is Win10 also in German
  • The flow is suppose to start shortly after the computer has been rebooted 

 

 

  • RaszelDazsel Profile Picture
    2 on 14 Aug 2023 at 10:31:37
    Re: CMD Session does not start

    Thanks for that, I also experienced the same problem.

    I have a Desktop Flow executing commands in a CMD session, in the Desktop Flow it runs without error, but triggering the Desktop Flow with a Cloud Flow it errors.

    I notice the same that the CMD session was being executed from the Cloud Flow, using a Batch Script or PowerShell as suggested was the workaround.

     

    Thanks for help.

  • Hppyclown Profile Picture
    23 on 02 Mar 2023 at 00:02:41
    Re: CMD Session does not start

    Thanks for the update, I got around my issue by creating a batch file and executing the batch file using a powershell command in Power Automate. 

    Then i just converted what I was doing to Powershell. 

     

    Thanks again for replying.

  • OlafP Profile Picture
    11 on 01 Feb 2023 at 12:10:32
    Re: CMD Session does not start

    Unfortunately not. A few month ago I updated to the latest version of PA avaible back then to see if that had any effect but no, problem still exists to this day. I guess I am lucky that my affected flow is not a crucial one and also not a long one, so I always run mine in Edit mode. đźŚš 

  • Hppyclown Profile Picture
    23 on 01 Feb 2023 at 09:54:09
    Re: CMD Session does not start

    Hey, did you find a solution to this issue, I’m experiencing the same problem with launching cmd commands with my glue just hanging there.

     

     

  • fraenK Profile Picture
    2,125 on 13 Apr 2021 at 19:07:57
    Re: CMD Session does not start

    If you can, report this issue to Microsoft. In edit mode, flows run awfully slow.

  • OlafP Profile Picture
    11 on 13 Apr 2021 at 13:10:47
    Re: CMD Session does not start

    Yes, I did, I'm on version 2.6.00158.21069 now. Still doesn't work. At least I know that it wasn't something in my code and that it is working on other machines. I guess from now on I will run my flows only from edit window to be on the safe side.

  • fraenK Profile Picture
    2,125 on 13 Apr 2021 at 11:15:18
    Re: CMD Session does not start

    Your code works fine for me in console and edit mode. Did you update PAD to the latest version?

  • OlafP Profile Picture
    11 on 13 Apr 2021 at 11:07:09
    Re: CMD Session does not start

    Thank you for investing time and trying it on your machine, sharing the results with me. It seems that my company's laptop or IT infrastructure has something to do with it then. Maybe its a security thing.

     

    Here's the code of the Flow I tested this issue with, just in case:

     

    Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.Personal SpecialFolderPath=> SpecialFolderPath
    Cmd.Open Directory: SpecialFolderPath Session=> CmdSession
    Cmd.Write Session: CmdSession Command: $'''ipconfig''' SendEnter: True
    Cmd.Read Session: CmdSession CmdOutput=> CmdOutput
    Cmd.Close Session: CmdSession
    File.WriteText File: $'''C:\\Users\\olafp\\Desktop\\CmdCheck.txt''' TextToWrite: CmdOutput AppendNewLine: True IfFileExists: File.IfFileExists.Overwrite Encoding: File.FileEncoding.Unicode
    System.RunApplication ApplicationPath: $'''C:\\Users\\olafp\\Desktop\\CmdCheck.txt''' WindowStyle: System.ProcessWindowStyle.Normal ProcessId=> AppProcessId

     

    I also tried different folders for CMD session, including the default one.

  • fraenK Profile Picture
    2,125 on 13 Apr 2021 at 10:32:50
    Re: CMD Session does not start

    Strange, even with ipconfig it works fine for me. Could you paste your flow code here?

     

    Did you try a different working folder, like your user folder?

    Any reason you didn't yet update to Windows 10 version 2004?

    Any security software which might prevent app execution?

  • OlafP Profile Picture
    11 on 13 Apr 2021 at 10:08:07
    Re: CMD Session does not start

    There is no error message, the command just don't get executed properly.

     

    I did some more testing and was able to narrow down the problem more. The specific CMD command ipconfig seems to play a role here.

    Whenever I let PAD write the command ipconfig to CMD session, CmdOutput holds different outputs depending on which window the Flow has been started from.

    When starting the flow from edit window, the result is as expected, CmdOutput holds the usual expected information about Windows IP configuration, ethernet adapters, IPs, subnet masks etc. etc.

    When starting the flow from main window CmdOutput holds only this information:

     

    Microsoft Windows [Version 10.0.18363.1440]
    (c) 2019 Microsoft Corporation. Alle Rechte vorbehalten.

    C:\Program Files (x86)\Power Automate Desktop>ipconfig

     

    Nothing more.

    I tested another CMD command: dir generates the same expected output no matter which PAD-window I start the flow from.

     

    What am I missing? Any idea what causes this problem? Can I add something to my flow to prevent this from happening?

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 4 Super User 2025 Season 1

#2
KO-05050229-0 Profile Picture

KO-05050229-0 2

#2
stampcoin Profile Picture

stampcoin 2

Overall leaderboard
Loading started