# 强制覆盖单个文件 (UTF-8 BOM) param([string]$LocalPath, [string]$RemotePath) $FtpHost="116.198.221.125" $FtpPort=21 $FtpUser="wenchuanyi" $FtpPass="r7P^f*v7rFts" $r=[System.Net.FtpWebRequest]::Create("ftp://${FtpHost}:${FtpPort}/"+$RemotePath.TrimStart('/')) $r.Method=[System.Net.WebRequestMethods+Ftp]::UploadFile $r.Credentials=New-Object System.Net.NetworkCredential($FtpUser,$FtpPass) $r.UsePassive=$true $r.UseBinary=$true $r.KeepAlive=$false $r.Timeout=120000 $b=[System.IO.File]::ReadAllBytes($LocalPath) $r.ContentLength=$b.Length $s=$r.GetRequestStream() try{ $s.Write($b,0,$b.Length) }finally{ $s.Close() } $resp=$r.GetResponse() try{ $resp.Close() }catch{} Write-Host "FORCED_UPLOAD_OK $RemotePath"