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

Author Message
kesavan
[View user's profile]

Joined: 2008-09-18
Posts: 2
Location: India
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
kesavan
[View user's profile]

Joined: 2008-09-18
Posts: 2
Location: India
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
See guide to using WinSCP from .NET.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License