【问题标题】:SCP in PowerShell reverts to CMD.exe [closed]PowerShell 中的 SCP 恢复为 CMD.exe [关闭]
【发布时间】:2022-11-15 18:09:07
【问题描述】:

我正在尝试在需要 PowerShell 的网络驱动器上使用 SCP。但是当我输入我的 SCP 命令时,它说

CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
The system cannot find the path specified.
        0 file(s) copied.

使用 SCP 时如何防止 PowerShell 恢复为 cmd.exe?

编辑:这是我的命令,虽然我不明白为什么这会有所作为。 scp -i ~/.ssh/my_key.pem \\my\network\drive\toy.py user@10.xxx.xxx.xx:/home/user/target/path/toy.py

【问题讨论】:

    标签: windows powershell cmd scp


    【解决方案1】:

    一种解决方案是将 UNC 路径映射到 Windows 驱动器,打开 Powershell.exe,使用 substcd 到该目录:

    subst M: \serverpathotherPath
    cd M:
    scp whatever host:whateverElse
    

    上面的例子假设 M: 驱动器号未使用。

    【讨论】:

      猜你喜欢
      • 2014-12-12
      • 2010-10-26
      • 2010-10-13
      • 2014-07-13
      • 2010-12-09
      • 2010-09-06
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      相关资源
      最近更新 更多