Terminal: Windows 10 Build 1809 - Problem to run scripts from CMD/Powershell

Created on 26 Mar 2020  路  11Comments  路  Source: microsoft/terminal

Hello,

I'd need help with this if possible.

Environment

Windows 10.0.17763.1098

Steps to reproduce

  • Open command prompt
  • Execute Perl or Python script without specifying the full path of Perl or Python executable, just by using the script name.

Expected behavior

  • Script should process and output whatever is in the script.

Actual behavior

  • Getting a blank line and going back to the command prompt.

Already checked solution

  • Registry InheritConsoleHandles, doesn't exist in our environment.
  • File association is correctly done, this is working on other machines but slowly starts to be a problem on more and more machines.
  • It's possible to run the script this way "perl myscript.pl" but running "myscript.pl" doesn't do anything, skip a line.
  • We have applications relying on this and it gets very frustrating not having it working.

Any help with this would be fantastic!
John

Issue-Question Needs-Attention Needs-Tag-Fix Resolution-Answered

All 11 comments

Wait did this _ever_ work before? I'd have thought you'd _always_ need to specify the interpreter (perl, python, etc) in the commandline. I know *nix (or something else in the stack, idk what exactly) lets you shebang the path of the interpreter at the top of the file, but that definitely doesn't work by default in Windows.

Do you know what version of Windows this _used to_ work on?

Yes it works perfectly fine on another 1809.
Actually you just input your filename and it opens with whatever program the extension is associated to.
In my case, nothing happens actually scripts or not, nothing happens.

If I take another machine, command prompt "file.txt" it opens my file.

This requires perl/python to be set up as the handler for pl and py files. There's nothing Command Prompt can do about this.

Hi DHowett, I know how to set the handler/file association but this doesn't work via Command prompt on certain machines. It works just fine if I double click on it. The problem definitely comes from the CMD.

Hey guys, I identified that it has nothing to do with the scripts. It actually doesn't open anything when I only use filename, including text files. Whatever I add after the filename (as argument) also as not effect.

Ex:

myfile.txt
myfile.txt blabla
myscript.py
myscript.pl
mypicture.png /itdoesntchangeanything

Would you have any idea? Because this seems to me very related to the terminal itself.

Multiple users in our organisation reported the same issue.

After restarting the Windows Management Instrumentation (Winmgmt) service and opening a new cmd window this works again, until you reboot.

Easiest reproducer is to create a file test.txt and enter test.txt in cmd/conhost, it should open notepad but instead it returns immediately to the prompt.

Multiple users in our organisation reported the same issue.

After restarting the Windows Management Instrumentation (Winmgmt) service and opening a new cmd window this works again, until you reboot.

Easiest reproducer is to create a file test.txt and enter test.txt in cmd/conhost, it should open notepad but instead it returns immediately to the prompt.

Wow thank you for this, it actually helps to know that this is related to the Winmgmt service.
I don't know yet what caused this but at least it gives a good help to investigate.

So we have exactly the same problem. What's your Windows Build?

Do you run ManageEngine's Desktop Central Agent by any chance? I've done some more investigation today and got the issue confirmed by ManageEngine's support today who confirmed it's caused by a recent agent upgrade.

If not check your WMI logs under "Applications and Service Logs > Microsoft > Windows > WMI-Activity > Operational" in Event Viewer.

In any case this is not an issue with cmd / this repository so we should probably take the discussion elsewhere. Apologies for the noise Microsoft! 馃槉

There you go, yes we do! I'll write to you directly!

Apologies Microsoft but it will probably help someone else.

@glorang how can I contact you?

It's on my profile now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cinnamon-msft picture cinnamon-msft  路  62Comments

migueldeicaza picture migueldeicaza  路  58Comments

dhavalhirdhav picture dhavalhirdhav  路  56Comments

pingzing picture pingzing  路  212Comments

DHowett-MSFT picture DHowett-MSFT  路  285Comments