Scripting Issues with FTPS

Advertisement

goandersen
Joined:
Posts:
2
Location:
Omaha

Scripting Issues with FTPS

I need to modify an existing application to use FTPS to send data to a remote host. I have created a stored session that I can successfully invoke from the script within my application to open my session with the remote host. However, I am required to make the script independent of my stored session, and I need to include the username and password in the open command (I think).
How do I code the Open command to include the username and password?

Reply with quote

Advertisement

pavan1291
Guest

Insert file.txt to winscp command

Hi All,
I need to insert .bat file which contains
Hostname,user name,command to upload files in a single file.can u please let me know the command

The example is below
test.txt contains
@exho off
winscp.exe /console /scripts=D:\FTP\ftpinput.txt"
exit

ftpinput.txt


winscp
open hostid
username
password
lcd local dir
cd ftp dir
prompt
bin
hash
mget File
bye


Thanks
Pavan

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Insert file.txt to winscp command

pavan1291 wrote:

Hi All,
I need to insert .bat file which contains
Hostname,user name,command to upload files in a single file.can u please let me know the command
Please read documentation:
https://winscp.net/eng/docs/guide_automation
_________________
Martin Prikryl

Reply with quote

oplsjames
Joined:
Posts:
1
Location:
Oklahoma

FTPS works with Console, but fails in command line...

I am unable to open an ftps implicit session via command line. The GUI session works fine, but I need to automate the process. <account> is our account name, <password> is the password and <key> is the certificate key. I removed them to post my issue. Sorry, I do not know how to set logging to debug from the command line. Any idea why the FTPS protocol is not being invoked?


I am calling WinSCP via WinBatch in the following line:
Format:RunShell( programname, params, directory, @NORMAL|@ICON|@ZOOMED|@HIDDEN, @WAIT|@NOWAIT|@GETPROCID|@GETEXITCODE )

Code:RunShell("C:\Program Files\WinSCP\WinSCP.com", "/implicit /certificate=<key> /passive /script=c:\scripts\eAuditSolutions_WinSCPscript.txt /log=""C:\Documents and Settings\jranone\desktop\eAudit.log""", "C:\Program Files\WinSCP\", @NORMAL, @NOWAIT)


With the following script file:
# Automatically answer all prompts negatively not to stall the script on errors
option batch on

# Disable overwrite confirmations that conflict with the previous
option confirm off

# Connect using a username and password
open <account>:<password>@www.eauditsolutions.com:990

# Change local directory
lcd c:\scripts

#upload the 340b file to the remote directory
put *_340b.txt

#end session
#close

#close WinSCP.com session
#exit

Log results:
. 2011-12-05 09:57:56.346 --------------------------------------------------------------------------
. 2011-12-05 09:57:56.356 WinSCP Version 4.3.5 (Build 1463) (OS 5.1.2600 Service Pack 3)
. 2011-12-05 09:57:56.356 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2011-12-05 09:57:56.366 Local account: SMC\JRANONE
. 2011-12-05 09:57:56.366 Login time: Monday, December 05, 2011 9:57:56 AM
. 2011-12-05 09:57:56.366 --------------------------------------------------------------------------
. 2011-12-05 09:57:56.366 Session name: <account>@www.eauditsolutions.com (Modified stored session)
. 2011-12-05 09:57:56.366 Host name: www.eauditsolutions.com (Port: 990)
. 2011-12-05 09:57:56.366 User name: <account> (Password: Yes, Key file: No)
. 2011-12-05 09:57:56.366 Tunnel: No
. 2011-12-05 09:57:56.366 Transfer Protocol: SFTP (SCP)
. 2011-12-05 09:57:56.376 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2011-12-05 09:57:56.376 Proxy: none
. 2011-12-05 09:57:56.376 SSH protocol version: 2; Compression: No
. 2011-12-05 09:57:56.376 Bypass authentication: No
. 2011-12-05 09:57:56.376 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2011-12-05 09:57:56.376 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2011-12-05 09:57:56.376 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2011-12-05 09:57:56.376 SFTP Bugs: -,-
. 2011-12-05 09:57:56.376 Return code variable: Autodetect; Lookup user groups: Yes
. 2011-12-05 09:57:56.376 Shell: default
. 2011-12-05 09:57:56.376 EOL: 0, UTF: 2
. 2011-12-05 09:57:56.376 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2011-12-05 09:57:56.376 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2011-12-05 09:57:56.386 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-12-05 09:57:56.386 Cache directory changes: Yes, Permanent: Yes
. 2011-12-05 09:57:56.386 DST mode: 1
. 2011-12-05 09:57:56.386 --------------------------------------------------------------------------
. 2011-12-05 09:57:56.386 Looking up host "www.eauditsolutions.com"
. 2011-12-05 09:57:56.476 Connecting to 216.115.245.55 port 990
. 2011-12-05 09:57:56.556 Waiting for the server to continue with the initialisation
. 2011-12-05 09:57:56.597 Detected network event
. 2011-12-05 09:58:11.599 Waiting for data timed out, asking user what to do.
. 2011-12-05 09:58:11.609 Asking user:
. 2011-12-05 09:58:11.609 Host is not communicating for 15 seconds.
. 2011-12-05 09:58:11.609
. 2011-12-05 09:58:11.609 Wait for another 15 seconds? ()
. 2011-12-05 09:58:11.629 Attempt to close connection due to fatal exception:
* 2011-12-05 09:58:11.629 Terminated by user.
. 2011-12-05 09:58:11.629 Closing connection.
. 2011-12-05 09:58:11.629 Sending special code: 12

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: FTPS works with Console, but fails in command line...

Should be:

RunShell("C:\Program Files\WinSCP\WinSCP.com", "/script=c:\scripts\eAuditSolutions_WinSCPscript.txt /log=""C:\Documents and Settings\jranone\desktop\eAudit.log""", "C:\Program Files\WinSCP\", @NORMAL, @NOWAIT)

...

open -implicit -certificate="<key>" -passive ftps://<account>:<password>@www.eauditsolutions.com
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum