using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Security; using System.Diagnostics; using System.Net; namespace PublishSite { public partial class PublishForm : Form { public PublishForm() { InitializeComponent(); } private void PublishForm_Load(object sender, EventArgs e) { string remoteComputerName = "123.56.94.154"; // 远程计算机名称 string userName = "Administrator"; // 用户名 string password = "WHxckj2019"; // 密码 string localFilePath = $@"D:\testUpload.txt"; string remoteFilePath = $@"C:\temp\testUpload.txt"; CopyFileToRemote(localFilePath, remoteFilePath, remoteComputerName, userName, password); } } }