PSCP 是否适用于 PowerShell? [英] Does PSCP work with PowerShell?

查看:52
本文介绍了PSCP 是否适用于 PowerShell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生成文本文件的 PowerShell 脚本.最后,我想将此文件复制到 Linux 服务器.从 CMD.EXE,我可以使用 PSCP(来自 Putty),它可以工作并复制文件.但是在 PowerShell 中,无论是交互方式还是 PowerShell 批处理,PSCP 都没有可见的效果:没有错误消息,文件也不会被复制.即使我只运行 .\PSCP.EXE 而不带参数,它也会在 CMD 命令行上显示选项,但在 PowerShell 中它什么也不做.可以从 PowerShell 内部使用 PSCP 吗?

I have a PowerShell script that produces a text file. At the end, I would like to copy this file to a Linux server. From CMD.EXE, I can use PSCP (from Putty), it works and copies the file. But from PowerShell, either interactively or from a PowerShell batch, PSCP has no visible effect: no error messages and the file is not copied. Even if I run simply .\PSCP.EXE without arguments, on the CMD command line it displays the options, but from PowerShell it does nothing. Can PSCP be used from inside PowerShell?

推荐答案

在 PowerShell 中执行程序应该与 CMD 相同,但取决于该程序如何产生其输出(它是否写入 STDOUT、STDERR 或其他?)行为可能不同.

Executing a program from within PowerShell should work identically to CMD, but depending upon how that program produces its output (does it write to STDOUT, STDERR, other?) that may behave differently.

我一直在使用 Rebex 的组件 FTPS &.NET 应用程序中的 SFTPPowerShell 脚本;SFTP 包包含一个 SCP 类.是的,它需要花钱,但根据您的使用情况,它可能是值得的.

I've been using Rebex's components for FTPS & SFTP within .NET apps & PowerShell scripts; the SFTP package includes an SCP class. Yes, it costs money, but depending upon your usage it may be worthwhile.

这篇关于PSCP 是否适用于 PowerShell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆