I am trying to run a batch file from a c# console app. The file does a simple ftp get.
The batch file runs fine when run normally (double clicking in windows or from a command line), but when called through the c# it errors. This is my c#:
StartInfo psi = new System.Diagnostics.Process
psi.WindowStyle = System.Diagnostics.Process
psi.UseShellExecute = false;
listFiles = System.Diagnostics.Process
System.IO.StreamReader myOutput = listFiles.StandardOutput;
Although I think :
...is all that is needed but the longer way lets me capture the error.
The batch file looks like this:
ftp -i -s:script.txt ftp.mysite.com
Notice that it references script.txt. This contains the login details and commands for the FTP. However an error occurs
"Error opening script file script.txt". This only happens when run through the c#.
I've given 'everyone' full permissions on the folder so there shouldn't be an issue there.
This is the content of script.txt:
get myfile.zip c:\tmp\Local.zip
The listfiles object in the c# is full of System.InvalidOperationExc
Any help would be great