Topic "Not able to upload files using Windows service"

Author Message
[View user's profile]

Joined: 2009-12-01
Posts: 1
Location: Texas

i am trying to upload files from Local system to Remote system using SFTP

when i look into log file this is the information i see

<?xml version="1.0" encoding="UTF-8" ?>
<session xmlns="" name="" start="2009-11-30T22:20:20.296Z" />

When i run the script using regular button click method it works fine but when i use windows service and put it on my production server it creates files on my local folder but doesn't send files to remote system.

below is the script i am using
Const logname As String = "C:\log.xml"

' Run hidden WinSCP process
Dim winscp As Process = New Process()
winscp.StartInfo.FileName = "C:\program files\winscp\"
winscp.StartInfo.Arguments = "/log=" + logname
winscp.StartInfo.UseShellExecute = False
winscp.StartInfo.RedirectStandardInput = True
winscp.StartInfo.RedirectStandardOutput = True
winscp.StartInfo.CreateNoWindow = True

' Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort")
winscp.StandardInput.WriteLine("option confirm off")
winscp.StandardInput.WriteLine("option transfer binary")
winscp.StandardInput.WriteLine("open s")
winscp.StandardInput.WriteLine("cd /x/y/")
winscp.StandardInput.WriteLine("put" & path)

' Collect all output (not used in this example)
Dim output As String = winscp.StandardOutput.ReadToEnd()

' Wait until WinSCP finishes
when i run it throught it works fine

please help
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
Please read FAQ. If that does not help, come back.
Martin Prikryl

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License