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.exedotnet and .dotnet\tools folders are present in PATHWhile I'm sure that your own solution helped, it's worth digging deeper:
The
dotnetand.dotnet\toolsfolders 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With