1

There are several solutions posted to that explain how to pass multiple arguments to ProcessStartInfo to run a DOS command with more than one argument. None of them work in this particular case.

Trying to run ncftpget from inside a c# application - passing multiple arguments to the executable using an exact string literal (@"arg1 arg2 arg3").

What's happening is that the argument list is long enough that it is getting truncated, but not where I would expect (at the end).

So I pass something like:

Program = "ncftpget"
Arguments = @"-f host.cfg D:\ServerBackups\Windows6 2012_01_28_SQLBackupFile.bak"

And what ncftp gets is

-f host.cfg D:\ServerBackups\Windows6 ackupfile.bak

If instead of calling ncftpget directly, I write a bat file and execute that, it works.

The odd thing is that from T/SQL using XP_CMDShell - I am calling ncftpget with arguments much longer than this. It is as if there is some environment variable that says "parameters can only be so long, and I am going to truncate them from the beginning, not the end"

I've tried quoting the arguments, makes no difference, same behavior.

Of course if Microsoft actually had a decent ftp solution... that used the correct mode...but that's an old rant that they will never fix.

svick
  • 236,525
  • 50
  • 385
  • 514

0 Answers0