首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >Windows 8.1无法从cmd或Powershell提示符启动powershell --“此应用程序无法在您的PC上运行”

Windows 8.1无法从cmd或Powershell提示符启动powershell --“此应用程序无法在您的PC上运行”
EN

Stack Overflow用户
提问于 2016-01-20 23:44:20
回答 2查看 5.8K关注 0票数 4

Powershell突然从cmd和powershell提示中停止打开。我没有安装任何新的之间的工作,当它确实工作和停止工作。

当我尝试使用以下命令从cmd窗口启动powershell.exe时(包括提升窗口和未提升窗口)

代码语言:javascript
代码运行次数:0
运行
复制
C:\Users\myuser>powershell.exe

我从操作系统中得到一个弹出错误,上面写着:

代码语言:javascript
代码运行次数:0
运行
复制
This app can't run on your PC

关闭该弹出的cmd提示后,我将从那时开始进行调用:

代码语言:javascript
代码运行次数:0
运行
复制
Access is denied

到屏幕上(是的,即使我在提升的cmd提示符中也这样做)

当我尝试用下面的命令在powershell中执行时:

代码语言:javascript
代码运行次数:0
运行
复制
PS C:\Users\myuser> powershell.exe

我得到:

代码语言:javascript
代码运行次数:0
运行
复制
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了。

我试过重新启动电脑,但这并没有修复它,但我完全不知道下一步该做什么。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-11-09 15:00:11

@PetSerAl在关于这个问题的评论中给出了关键的指针。

Windows 8或更高版本的“此应用程序无法在您的PC上运行”弹出错误消息

表示:

  • 损坏的文件,如0字节文件,尤指.然后是控制台中的“拒绝访问”错误。
  • 或者,越来越不常见的是,试图在32位版本的Windows上运行64位可执行文件。

故障排除步骤:

  • 从命令提示符( where.exe <executable-name>;控制台)运行cmd.exeGet-Command -All <executable-name>,中,运行PowerShell,它以该名称显示$env:PATH环境变量中列出的目录中的所有可执行文件,并按它们的完整路径排列。 注意,与where.exe不同的是,Get-Command也在当前目录中查找,并且首先在那里查找。 因此,返回的第一个路径是在只指定可执行文件名称时实际执行的可执行文件。
代码语言:javascript
代码运行次数:0
运行
复制
- 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的输出中,请检查:
代码语言:javascript
代码运行次数:0
运行
复制
- 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 (常规命令提示符)的:

代码语言:javascript
代码运行次数:0
运行
复制
where powershell.exe 

示例输出:

代码语言:javascript
代码运行次数:0
运行
复制
C:\Windows\System32\powershell.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

:PowerShell:

代码语言:javascript
代码运行次数:0
运行
复制
Get-Command -All powershell.exe

如果还想查看当前目录,请使用

Get-Command -All .\powershell.exe, powershell.exe

示例输出:

代码语言:javascript
代码运行次数:0
运行
复制
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

如果要将文件大小包括在输出中:

代码语言:javascript
代码运行次数:0
运行
复制
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
票数 5
EN

Stack Overflow用户

发布于 2017-02-16 05:57:42

从location C:\Windows\System32中删除powershell.exe ( 0KB)在删除系统32中的powershell.exe ( 0KB)后运行良好

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34912830

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档