How to transfer files in. net by using cmd line option

Advertisement

kesavan
Joined:
Posts:
2
Location:
India

How to transfer files in. net by using cmd line option

Hi,

I want to upload the files by using winscp in my .net windows application.

I heard from other forums topics that there is no API (like dlls) to use Winscp in .net

And Also we heard like we can do it by command line option.

Please provide the scripts and the sample code in .net to transfer the files using command line option, as its very urgent.

Thanks in Advance.

Regards,
Kesavan

Reply with quote

Advertisement

kesavan
Joined:
Posts:
2
Location:
India

Re: How to transfer files in. net by using cmd line option

Hello,

I uploaded the file by executing batch file in .net. I followed the below steps and can upload the file.

1) Created the script file(e.g: script.txt) and placed the below code

/////////////////////////////////////////////////////////////
option batch on
option confirm off

//username:password@IP:port number
open ste1698:1nitpass1@ftsqa.jpmchase.com:22

option transfer binary

cd "/hf020"

put "C:\test\5.txt"

close
exit
/////////////////////////////////////////////////////////////

2) Created a batch file(e.g: winscp.bat) and placed the below code
/////////////////////////////////////////////////////////////
@echo off

call "c:\program files\winscp\winscp.com" /script="C:\Test\script.txt"

exit
/////////////////////////////////////////////////////////////

3) Executed the above batch file in my .net application with the below code:

System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(@"c:\test\winscp.bat");
System.Diagnostics.Process proc=new System.Diagnostics.Process();
proc.StartInfo = p;
proc.Start();
proc.WaitForExit();


Please advise whether I am on the correct tract.


Thanks and Regards,
Kesavan

Reply with quote

Advertisement

You can post new topics in this forum