[英]scp from Linux to Windows: 'C:\Program' is not recognized error
In my linux machine, I'm trying to send a file over to a Windows machine via:在我的 linux 机器中,我试图通过以下方式将文件发送到 Windows 机器:
scp fileNameA user@windowServer:fileNameA
I get the following message:我收到以下消息:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.可运行的程序或批处理文件。
What's prompting this message?是什么提示这个消息?
I've installed OpenSSH on the windows machine, and I can successfully SSH into it.我已经在 windows 机器上安装了 OpenSSH,我可以成功地通过 SSH 进入它。 I don't want to use WinSCP, FileZilla, etc, because I have to automate this in a script.
我不想使用 WinSCP、FileZilla 等,因为我必须在脚本中自动执行此操作。 This has to be done from the Linux machine, so I'm not interested in doing pscp from the Windows machine.
这必须在 Linux 机器上完成,所以我对从 Windows 机器上执行 pscp 不感兴趣。
I have met the same problem today.我今天遇到了同样的问题。
I think it is an issue in the new version of OpenSSH, which was published few days ago.我认为这是几天前发布的新版本 OpenSSH 中的一个问题。 I reverted previous version (v7.6.1.0p1-Beta), which was working correctly on my VM from https://github.com/PowerShell/Win32-OpenSSH/releases and problem was fixed without any changes in configuration.
我从https://github.com/PowerShell/Win32-OpenSSH/releases恢复了以前的版本 (v7.6.1.0p1-Beta),该版本在我的 VM 上正常工作,问题得到解决,配置没有任何更改。
I just fixed the same problem by moving my installation of OpenSSH from C:\\Program Files\\OpenSSH
to C:\\OpenSSH
.我只是通过将我的 OpenSSH 安装从
C:\\Program Files\\OpenSSH
到C:\\OpenSSH
来解决同样的问题。
I had to first uninstall it properly using the provided script in Win32-OpenSSH and then follow back the information provided there https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH but only changing the path to C:\\OpenSSH.我必须首先使用 Win32-OpenSSH 中提供的脚本正确卸载它,然后按照https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH 中提供的信息返回,但只将路径更改为C:\\OpenSSH。
I met a similar issue today, trying to copy files to a Windows server running OpenSSH-Win64 .我今天遇到了类似的问题,试图将文件复制到运行OpenSSH-Win64的 Windows 服务器。 I solved the problem by adding
C:\\Program Files\\OpenSSH
, which is the recommended installation location, to the Windows path:我通过将
C:\\Program Files\\OpenSSH
(推荐的安装位置)添加到 Windows 路径解决了该问题:
Then, do not forget to restart the OpenSSH service, either in the service management console or by running net stop sshd
, followed by net start sshd
in an elevated console.然后,不要忘记在服务管理控制台中或通过运行
net stop sshd
,然后在提升的控制台中运行net start sshd
重新启动 OpenSSH 服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.