Click here to Skip to main content
15,921,841 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Hi,

I am trying to FTP certain files from Client system to my own system using a C# application. As the backend is a mainframe PS, so normally I use DOS commands in client systems to login and then FTP the files. But now, I am thinking of automating it a little bit by creating an application that will create a batch file, execute it, FTP the files and then delete that batch file. All processes are working properly but there is only one problem and it is HUGE.

When I create the batch files, it is created successfully, but while executing it, it opens another instance of the .NET application and thus does not execute. But if I delete the application exe file, then the batch files run successfully and FTPies the files properly.

But I am not getting, why is it opening an instance of the application and does not run when the application file is present. Is there any way to get rid of this?

I am placing the exe in the client system, and ftp the files from mainframes to a drive in client system, then copy it to a mapped drive (U:\) which is our D Drive.
The batch files work correctly without the application file.

Please help me resolve the problem.

Thanks
Jashobanta
Posted
Updated 3-May-12 13:51pm
v3

You say

When I create the batch files, it is created successfully, but while executing it, it opens another instance of the .NET application.

I'm not clear if you are running the batch file at all, as it would not start the .NET application unless it contained a command to do so.

Without seeing any code it's difficult to give an answer but my guess would be that the batch file has the same name as the application, e.g. MyApp.exe and MyApp.bat, and the system doesn't know which one you want.

Process.Start("MyApp") would start the exe but Process.Start("MyApp.bat") would do the right thing.

Alan.
 
Share this answer
 
After the line:
C#
sw.Write("cd U:\\jashobanta"+Environment.NewLine);


add this line:
C#
sw.Write("U:" + Environment.NewLine);


Hope this helps!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900