"Moojjoo" <Mo*****@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
startInfo.Arguments = "/C YourFTPCommandGoesHere";
What does the /C mean?
It tells the command interpreter to carry out the command and then quickly
exit.
I replaced it with
ProcessStartInfo startInfo;
startInfo = new ProcessStartInfo("cmd.exe");
startInfo.Arguments = "/C ftp -s:Idx.scr";
startInfo.CreateNoWindow = true;
Process.Start(startInfo);
And it just keeps poping a CMD window over and over.
Change /C to /K and try it again. /K keeps the command window open so that
you can see what FTP is doing.
Here I used this FTP script:
open localhost
user ***** *******
binary
get file.ext
quit
where the asterisks represent my user name and password and this source:
using System;
using System.Diagnostics;
class Class1
{
[STAThread]
static void Main(string[] args)
{
ProcessStartInfo startInfo;
startInfo = new ProcessStartInfo("cmd.exe");
startInfo.Arguments = "/C ftp -n -s:c:\\ftp.scr";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(startInfo);
}
}
It works for me, here.
Just by the way, I use a hidden window style so that I don't get that
annoying flash of the command window. You'll want to see the command window
while testing.
Regards,
Will