Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: winscp.com with c# and put command

Crosspost.
dmishoe

winscp.com with c# and put command

/// Run hidden WinSCP process
Process winscp = new Process();
winscp.StartInfo.FileName = "winscp.com";


winscp.StartInfo.Arguments = "/log=" + logname;
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
//winscp.StartInfo.FileName = "test_daimler.vdi";

winscp.StartInfo.CreateNoWindow = true;
winscp.Start();

/// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch on");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open mysession");
winscp.StandardInput.WriteLine("ls");
winscp.StandardInput.WriteLine("RM *.vdi*");
winscp.StandardInput.WriteLine("ls");

winscp.StandardInput.WriteLine("put c:\\test_daimler_1.vdi ");
//winscp.StandardInput.WriteLine("get *.*");
winscp.StandardInput.WriteLine("ls");
winscp.StandardInput.Close();

/// Collect all output (not used in this example)
string output = winscp.StandardOutput.ReadToEnd();

Console.WriteLine("output:" + output);


when I run the above script, the file names get put on the server as
%SFLNDSFTPT%SFLNDSFTPT%null%DONE%test_daimler1.vdi_0bte0l005q8e34fp00004srm

I can't seem to control the file name. How do I get rid of
%SFLNDSFTPT%SFLNDSFTPT%null%DONE%

Any and all help would be greatly appreciated.