Open AM-I-Human opened 9 months ago
I would like to add that I'm experiencing similar issues.
I'm using powershell 7-preview (PowerShell 7.5.0-preview.1) with a custom profile and winget v1.6.3482 is installed currently. When attempting to install the 'Command Not Found' module from PowerToys V0.78.0, I'm getting the following error.
System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'pwsh.exe' with working directory 'C:\Users\mcclellandk\AppData\Local\PowerToys'. The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.PowerToys.Settings.UI.ViewModels.CmdNotFoundViewModel.RunPowerShellScript(String powershellExecutable, String powershellArguments, Boolean hidePowerShellWindow)PowerShell 7.4 or greater not detected. Installation instructions can be found on https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows
Additionally, pwsh.exe is found within my system variables path, and the same results are experienced when running PowerToys as admin. When looking at the 'Command Not Found' settings in PowerToys, I'm being told that PowerShell 7.4 or greater and Winget Client PS module need to be installed, both are installed.
I am experiencing the same error.
However, I have found A temporary yet partial "patch". Here are the steps:
1 | If you already have PowerShell 7, move to Step 3! Otherwise, Copy powershell.exe
from:
%SystemRoot%\system32\WindowsPowerShell\v1.0\
2 | Paste the executable into C:\Program Files\PowerToys
folder
4 | Rename that copy from powershell.exe
to pwsh.exe
.
5 | Go to the Properties of that copy and enable Run this program as an administrator
6 | Go back to CNF (Command Not Found) and refresh the state.
7 | Click on the install button of PowerShell 7.4 or greater
8 | Now that PowerShell 7 exists on your system, repeat from Step 1
but instead of copying the powershell executable from System32, copy the pwsh.exe
that resides in PowerShell 7
's main folder.
Now you can also install winget
!
PLEASE NOTE THAT ALTHOUGH THIS MAY FIX THE "pwsh.exe not found" ERROR, THE STATUS OF THE INSTALLATION OF POWERSHELL 7 AND WINGET WILL NOT AND CANNOT UPDATE AS THE EXE COPIES MAY NOT BE THE SUPPOSED EXECUTABLE!
Also, for reproducing the issue, it could be just "delete the pwsh.exe
file from PowerToys root foder or install PowerToys v0.77.0 or v0.78.0" as those two version have the same issue
Microsoft PowerToys version
0.78.0
Installation method
Microsoft Store
Running as admin
No
Area(s) with issue?
Command not found
Steps to reproduce
Sadly I don't know. I have winget here
C:\Users\myusername\AppData\Local\Microsoft\WindowsApps\winget.exe
It is the same with Running as admin✔️ Expected Behavior
Winget found and green check visible
❌ Actual Behavior
[PSVersion, 7.4.1] [PSEdition, Core] [GitCommitId, 7.4.1] [OS, Microsoft Windows 10.0.22631] [Platform, Win32NT] [PSCompatibleVersions, System.Version[]] [PSRemotingProtocolVersion, 2.3] [SerializationVersion, 1.1.0.1] [WSManStackVersion, 3.0] PowerShell 7.4 or greater detected. WinGet Client module not detected. Installation instructions can be found on https://www.powershellgallery.com/packages/Microsoft.WinGet.Client
Command Not Found module is not registered in the profile file.
Other Software
I installed powershell with winget: And is now here:
C:\Program Files\PowerShell\7