C# 如何使用SharpSSH以编程方式从SFTP服务器运行命令?
我用Tamir SharpSSH一切正常 但我需要用c代码运行命令 我把文件服务器,但我需要运行的作品有人知道这个命令C# 如何使用SharpSSH以编程方式从SFTP服务器运行命令?,c#,.net,sharpssh,C#,.net,Sharpssh,我用Tamir SharpSSH一切正常 但我需要用c代码运行命令 我把文件服务器,但我需要运行的作品有人知道这个命令 SshTransferProtocolBase sshCp; const string sftp_host = "xxx"; const string sftp_user = "xxx"; const string sftp_pass = "xxx"; const int sftp_port = 22; var sftp = new Sftp(sftp_host, sftp_u
SshTransferProtocolBase sshCp;
const string sftp_host = "xxx";
const string sftp_user = "xxx";
const string sftp_pass = "xxx";
const int sftp_port = 22;
var sftp = new Sftp(sftp_host, sftp_user, sftp_pass);
sftp.Connect(sftp_port);
sftp.Put(@"D:\\" + Teslim + ".txt", "../");
sftp.Close();
此代码正在运行我需要将命令运行到根目录中???您不能通过FTP在远程服务器上执行代码。您不能使用Sftp执行命令-您必须使用SSH控制台会话来运行命令。Tamir SharpSSH通过
SshExec
对象支持这一点
有关使用它的示例,请参见示例