Topic "Using VB.NET 2005 with the following code--Exception occurs"

Author Message
Brent_badger
[View user's profile]

Joined: 2009-11-06
Posts: 8
Location: NC
Code:

Dim winscp As Process = New Process()
        winscp.StartInfo.FileName = "winscp.com"
        winscp.StartInfo.Arguments = "/log=" + logname
        winscp.StartInfo.UseShellExecute = False
        winscp.StartInfo.RedirectStandardInput = True
        winscp.StartInfo.RedirectStandardOutput = True
        winscp.StartInfo.CreateNoWindow = True
        winscp.Start()



When it executes, I get an unhandled exception saying "The system can not find the file specified" at the last line. This code was copied from the website for VB.NET automation here.

Problem is, I can't tell what file the system can not find. The data of the error says nothing.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Are you sure winscp.com can be found without specifying a full path in your setup?
_________________
Martin Prikryl
Brent_badger
[View user's profile]

Joined: 2009-11-06
Posts: 8
Location: NC
prikryl wrote:
Are you sure winscp.com can be found without specifying a full path in your setup?


That's what I was kind of wondering about. The examples on the .NET webpage didn't specify a path at all, but I couldn't tell what the error was referring to. Let me try it with the full path on my next batch run and see if that clears it up.
preddy

Guest


I implemented very simple application using the VB.NET class posted and tried tu upload a text file to an SFTP server (I can connect via another SFTP client). The code fails when it can't find a log file, on this line:
If Not File.Exists(logname) Then

Please advise. All I need to do is automate a daily file upload of a file matching a particular naming convention in a standard directory. .NET may be overkill, but I don't understand the explanation about Aautomating scripts - it seems to be full of holes. If I can get this working I'll gladly donate $100+

Thanks
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
preddy wrote:
I implemented very simple application using the VB.NET class posted and tried tu upload a text file to an SFTP server (I can connect via another SFTP client). The code fails when it can't find a log file, on this line:
If Not File.Exists(logname) Then

What code/class do you refer to?
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