【问题标题】:Powershell "The system cannot find the path specified" - minium example [duplicate]Powershell“系统找不到指定的路径”-最小示例[重复]
【发布时间】:2019-02-28 11:22:36
【问题描述】:

不可重现,似乎是本地环境问题:

bla.bat 文件具有以下内容:

@echo off

所以这个脚本实际上应该什么都不做。现在,当尝试从 PowerShell 执行脚本时,输出如下:

PS C:\Users\lwnjup2> .\bla.bat
The system cannot find the path specified.

而在 CMD 中,bat 文件作为例外执行(什么都不做...)。

所以我的问题是:为什么会出现这个奇怪的警告?有没有办法,我怎样才能获得更多的输出(即找不到什么路径)?在我看来,PowerShell 在执行任何 .bat(或 .cmd)文件时总是搜索某个路径。

PS:奇怪的是,我无法在另一台机器上重现行为,所以我似乎搞砸了我的 powershell 环境......

【问题讨论】:

  • 无法重现该问题。
  • 从那个控制台,你能运行Get-ChildItem env: 并告诉我ComSpec 变量的值吗?
  • @AdminOfThings 我有 C:\Windows\system32\cmd.exe
  • @AdminOfThings 好的,非常有趣:从 powershell 执行“C:\Windows\system32\cmd.exe”时,我得到:Microsoft Windows [Version 10.0.17763.316] (c) 2018 Microsoft Corporation。 Alle Rechte vorbehalten。 Das System kann den angegebenen Pfad nicht finden。”
  • 感谢您提示我使用 cmd.exe,找到并发布了解决方案。

标签: powershell


【解决方案1】:

解决方法与cmd.exe有关,在

Windows CMD.exe "The system cannot find the path specified."

我也有一些自动启动值...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-09
    • 1970-01-01
    • 2022-10-13
    • 2011-02-23
    • 2018-12-12
    相关资源
    最近更新 更多