Windows 10 Build 1809 - Problem to run scripts from CMD/Powershell #7157

Closed
opened 2026-01-31 00:56:39 +00:00 by claunia · 11 comments
Owner

Originally created by @ITMaya on GitHub (Mar 26, 2020).

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

Originally created by @ITMaya on GitHub (Mar 26, 2020). 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
claunia added the Issue-QuestionNeeds-Tag-FixResolution-AnsweredNeeds-Attention labels 2026-01-31 00:56:39 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Mar 26, 2020):

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?

@zadjii-msft commented on GitHub (Mar 26, 2020): 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 <sup>(or something else in the stack, idk what exactly)</sup> 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?
Author
Owner

@ITMaya commented on GitHub (Mar 26, 2020):

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.

@ITMaya commented on GitHub (Mar 26, 2020): 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.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 26, 2020):

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.

@DHowett-MSFT commented on GitHub (Mar 26, 2020): 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.
Author
Owner

@ITMaya commented on GitHub (Mar 27, 2020):

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.

@ITMaya commented on GitHub (Mar 27, 2020): 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.
Author
Owner

@ITMaya commented on GitHub (Mar 30, 2020):

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.

@ITMaya commented on GitHub (Mar 30, 2020): 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.
Author
Owner

@glorang commented on GitHub (Apr 6, 2020):

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.

@glorang commented on GitHub (Apr 6, 2020): 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.
Author
Owner

@ITMaya commented on GitHub (Apr 6, 2020):

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?

@ITMaya commented on GitHub (Apr 6, 2020): > > > 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?
Author
Owner

@glorang commented on GitHub (Apr 7, 2020):

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! 😊

@glorang commented on GitHub (Apr 7, 2020): 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! 😊
Author
Owner

@ITMaya commented on GitHub (Apr 7, 2020):

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

Apologies Microsoft but it will probably help someone else.

@ITMaya commented on GitHub (Apr 7, 2020): There you go, yes we do! I'll write to you directly! Apologies Microsoft but it will probably help someone else.
Author
Owner

@ITMaya commented on GitHub (Apr 7, 2020):

@glorang how can I contact you?

@ITMaya commented on GitHub (Apr 7, 2020): @glorang how can I contact you?
Author
Owner

@glorang commented on GitHub (Apr 8, 2020):

It's on my profile now.

@glorang commented on GitHub (Apr 8, 2020): It's on my profile now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7157