web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / CMD Session does not s...
Power Automate
Unanswered

CMD Session does not start

(0) ShareShare
ReportReport
Posted on 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 

 

 

I have the same question (0)
  • fraenK Profile Picture
    2,125 on at

    Is there an error message or what exactly doesn't work?

    I tried executing curl from within the documents folder, works fine.

     

    Try updating to the latest version first: https://go.microsoft.com/fwlink/?linkid=2102613

  • OlafP Profile Picture
    11 on at

    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?

     

     

  • fraenK Profile Picture
    2,125 on at

    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 at

    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 at

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

  • OlafP Profile Picture
    11 on at

    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 at

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

  • Hppyclown Profile Picture
    23 on at

    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.

     

     

  • OlafP Profile Picture
    11 on at

    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 at

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard