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

Advertisement

Brent_badger
Joined:
Posts:
8
Location:
NC

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

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

Re: Using VB.NET 2005 with the following code--Exception occurs

Are you sure winscp.com can be found without specifying a full path in your setup?

Reply with quote

Brent_badger
Joined:
Posts:
8
Location:
NC

Re: Using VB.NET 2005 with the following code--Exception occurs

martin 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.

Reply with quote

preddy
Guest

VB.NET implementation failing

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

Re: VB.NET implementation failing

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?

Reply with quote

Advertisement

You can post new topics in this forum