cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OlafP
Frequent Visitor

CMD Session does not start

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 

 

 

7 REPLIES 7
fraenK
Super User
Super User

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
Frequent Visitor

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?

 

 

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
Frequent Visitor

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
Super User
Super User

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

OlafP
Frequent Visitor

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.

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Kudoed Authors
Users online (970)