Powershell突然从cmd和powershell提示中停止打开。我没有安装任何新的之间的工作,当它确实工作和停止工作。
当我尝试使用以下命令从cmd窗口启动powershell.exe时(包括提升窗口和未提升窗口)
C:\Users\myuser>powershell.exe
我从操作系统中得到一个弹出错误,上面写着:
This app can't run on your PC
关闭该弹出的cmd提示后,我将从那时开始进行调用:
Access is denied
到屏幕上(是的,即使我在提升的cmd提示符中也这样做)
当我尝试用下面的命令在powershell中执行时:
PS C:\Users\myuser> powershell.exe
我得到:
Program 'powershell.exe' failed to run: The specified executable is not a valid application for this OS platform.
At line:1 char:1
+ powershell.exe
+ ~~~~~~~~~~~~~~.
At line:1 char:1
+ powershell.exe
+ ~~~~~~~~~~~~~~.
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorID : NativeCommandFailed
显然连powershell都不喜欢powershell了。
我试过重新启动电脑,但这并没有修复它,但我完全不知道下一步该做什么。
发布于 2016-11-09 07:00:11
@PetSerAl在关于这个问题的评论中给出了关键的指针。
Windows 8或更高版本的“此应用程序无法在您的PC上运行”弹出错误消息
表示:
故障排除步骤:
where.exe <executable-name>
;控制台)运行cmd.exe
在Get-Command -All <executable-name>
,中,运行PowerShell,它以该名称显示$env:PATH
环境变量中列出的目录中的所有可执行文件,并按它们的完整路径排列。
注意,与where.exe
不同的是,Get-Command
也在当前目录中查找,并且首先在那里查找。
因此,返回的第一个路径是在只指定可执行文件名称时实际执行的可执行文件。- Note that a match in the _current_ directory, if found by `where.exe`, only matters when calling the executable from `cmd.exe` (from the Command Prompt or a batch file), because PowerShell by design doesn't allow invocation of executables from the current directory by mere name.
- If you want to run `where.exe` from PowerShell, extension `.exe` is required, because the command name `where` by itself is a built-in alias for the `Where-Object` cmdlet.
where.exe
/ Get-Command
的输出中,请检查:- if the executable you expect is listed first.
- if its size is non-zero.
示例:
查找当前目录中和$env:PATH
中列出的目录中所有名为powershell.exe
的可执行文件。
请注意,powershell.exe
的正确归属是C:\Windows\System32\WindowsPowerShell\v1.0
,如$PSHOME
中所反映的。
来自cmd.exe
(常规命令提示符)的:
where powershell.exe
示例输出:
C:\Windows\System32\powershell.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
:PowerShell:
Get-Command -All powershell.exe
如果还想查看当前目录,请使用
Get-Command -All .\powershell.exe, powershell.exe
示例输出:
CommandType Name Version Source
----------- ---- ------- ------
Application powershell.exe 0.0.0.0 C:\WINDOWS\system32\powershell.exe
Application powershell.exe 10.0.14... C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
如果要将文件大小包括在输出中:
PS> where.exe powershell.exe | % { [system.io.fileinfo] $_ |
select fullname, length, @{ n = 'Version'; e = { $_.versioninfo.FileversionRaw } } }
FullName Length Version
-------- ------ -------
C:\Windows\System32\powershell.exe 0
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 446976 10.0.14393.206
发布于 2017-02-15 21:57:42
从location C:\Windows\System32中删除powershell.exe ( 0KB)在删除系统32中的powershell.exe ( 0KB)后运行良好
https://stackoverflow.com/questions/34912830
复制