Topic "Shell problem"

Author Message
pmkdatabase

Guest


I've spent many hours on this before asking for assistance. I am trying to shell from vba (MS Access). This was working before, and I am not sure what broke.

This works: shell("c:\ftp\winscp")
This does not (and there is no log file):
shell("c:\ftp\winscp /script=ftp_test.txt")

I can open the saved session "ftporders" from the console.

ftp_test.txt
============
open ftporders

Thank you!

this is the INI file entry for the session:
[Sessions\ftporders]
HostName=193.151.18.10
PortNumber=21
UserName=adam [snip]
FSProtocol=5
Password=A35C7A561384A4 [snip]
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please, enable the log file by /log=path_to_log and post the log file.
_________________
Martin Prikryl
pmkdatabase
[View user's profile]

Joined: 2012-02-13
Posts: 2
Location: Thailand
prikryl wrote:
Please, enable the log file by /log=path_to_log and post the log file.


I am making some progress with this problem. I think it might be something to do with paths. I'll post back if I hit another dead end.

Thank you for taking the time to reply.
pmkdatabase
[View user's profile]

Joined: 2012-02-13
Posts: 2
Location: Thailand
The problem is passing a dynamic name for the script file:
this works: ' hShell = Shell(GetDBPath & "winscp /script=C:\Users\peterk\Documents\IPOP\ftp_orders.txt")

However, when I build it in VBA, like this:
sScriptFile = GetDBPath & "ftp_orders.txt"
Debug.Print sScriptFile
(debug prints "C:\Users\peterk\Documents\IPOP\ftp_orders.txt)
hShell = Shell(GetDBPath & "winscp /script= " & sScriptFile)

Then it doesn't work.
Same thing for these:
hShell = Shell(GetDBPath & "winscp /script= .\ftp_orders.txt")
hShell = Shell(GetDBPath & "winscp /script= ftp_orders.txt")

Thank you.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
pmkdatabase wrote:
hShell = Shell(GetDBPath & "winscp /script= " & sScriptFile)

There may not be a space after the /script=
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
See how to use WinSCP .NET assembly from VBA:
http://winscp.net/eng/docs/library_vb
_________________
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