Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No executable found matching command "dotnet-script"

Why doesn't dotnet script run in PowerShell after installation? I closed and reopened all PowerShell instances after installing.

PowerShell throws this error when I run dotnet script init:

No executable found matching command "dotnet-script"

Edit:

  • dotnet script does run in cmd.exe
  • The dotnet and .dotnet\tools folders are present in PATH
like image 538
Eric Eskildsen Avatar asked Feb 19 '26 04:02

Eric Eskildsen


1 Answers

While I'm sure that your own solution helped, it's worth digging deeper:

The dotnet and .dotnet\tools folders are present in PATH

To produce your symptom, the former must be true, but not the latter:

It is dotnet.exe that issues the error message (implying that dotnet.exe itself indeed is in the PATH).

The error message indicates that a tool named script could not be located, implying that an executable named dotnet-script.exe could not be found in the PATH, because that's the executable name that dotnet constructs behind the scenes when you call dotnet script.

With a properly set up PATH (and, of course, dotnet-script installed), dotnet-script.exe should be found via the $HOME\.dotnet\tools directory in the PATH.

$HOME\.dotnet\tools is an entry stored as part of the user-specific PATH additions in the registry, and your PowerShell session seemingly hadn't picked up that entry yet - which can happen for the reasons mentioned in your answer.

like image 81
mklement0 Avatar answered Feb 21 '26 17:02

mklement0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!