Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Thanks

I did not notice the -append. For that you need to use SFTP.
VijayS

Thanks

Ok as per your suggestion I changed open to use scp://

but now the put command is overwriting the file instead of just appending to it. as per the documentation here https://winscp.net/eng/docs/scriptcommand_put append only works with sftp. Any workaround for appending to a file with SCP protocol? Maybe echo contents to a pipe ? echo 1.txt >> file.txt where 1 is local and file is remote.

also I see a lot of unalias commands in the log, anyway to suppress that or skip that? It's slowing the script by 21 seconds. I guess this is the startup conversation as the script says.

> 2014-02-03 16:04:34.270 echo "$status" ; echo "WinSCP: this is end-of-file:0"
< 2014-02-03 16:04:34.774 WinSCP: this is end-of-file:0
. 2014-02-03 16:04:34.774 The response is not numerical exit code
. 2014-02-03 16:04:34.774 Trying "$?".
> 2014-02-03 16:04:34.774 echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 2014-02-03 16:04:35.280 0
< 2014-02-03 16:04:35.280 WinSCP: this is end-of-file:0
. 2014-02-03 16:04:35.280 Return code variable "$?" selected.
. 2014-02-03 16:04:35.280 Clearing all aliases.
> 2014-02-03 16:04:35.280 unalias "ls" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:36.055 -bash: line 4: unalias: ls: not found
< 2014-02-03 16:04:36.055 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:36.056 unalias "echo" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:36.604 -bash: line 5: unalias: echo: not found
< 2014-02-03 16:04:36.604 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:36.605 unalias "pwd" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:37.108 -bash: line 6: unalias: pwd: not found
< 2014-02-03 16:04:37.108 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:37.108 unalias "cd" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:37.625 -bash: line 7: unalias: cd: not found
< 2014-02-03 16:04:37.625 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:37.625 unalias "groups" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:38.368 -bash: line 8: unalias: groups: not found
< 2014-02-03 16:04:38.368 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:38.369 unalias "scp" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:39.977 -bash: line 9: unalias: scp: not found
< 2014-02-03 16:04:39.977 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:39.977 unalias "rm" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:41.038 -bash: line 10: unalias: rm: not found
< 2014-02-03 16:04:41.038 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:41.038 unalias "mv" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:41.548 -bash: line 11: unalias: mv: not found
< 2014-02-03 16:04:41.549 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:41.549 unalias "mkdir" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:42.056 -bash: line 12: unalias: mkdir: not found
< 2014-02-03 16:04:42.056 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:42.056 unalias "chmod" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:42.560 -bash: line 13: unalias: chmod: not found
< 2014-02-03 16:04:42.560 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:42.561 unalias "chgrp" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:43.065 -bash: line 14: unalias: chgrp: not found
< 2014-02-03 16:04:43.065 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:43.066 unalias "chown" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:43.573 -bash: line 15: unalias: chown: not found
< 2014-02-03 16:04:43.573 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:43.574 unalias "unset" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:44.249 -bash: line 16: unalias: unset: not found
< 2014-02-03 16:04:44.249 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:44.250 unalias "unalias" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:45.670 -bash: line 17: unalias: unalias: not found
< 2014-02-03 16:04:45.670 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:45.671 unalias "ln" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:47.077 -bash: line 18: unalias: ln: not found
< 2014-02-03 16:04:47.077 WinSCP: this is end-of-file:1
> 2014-02-03 16:04:47.078 unalias "cp" ; echo "WinSCP: this is end-of-file:$?"
! 2014-02-03 16:04:47.602 -bash: line 19: unalias: cp: not found
< 2014-02-03 16:04:47.602 WinSCP: this is end-of-file:1
. 2014-02-03 16:04:47.602 Clearing national user variables.
> 2014-02-03 16:04:47.602 unset "LANG" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:48.239 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:48.239 unset "LANGUAGE" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:49.100 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:49.100 unset "LC_CTYPE" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:50.720 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:50.721 unset "LC_COLLATE" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:51.962 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:51.962 unset "LC_MONETARY" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:52.464 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:52.464 unset "LC_NUMERIC" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:52.968 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:52.968 unset "LC_TIME" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:53.524 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:53.525 unset "LC_MESSAGES" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:54.648 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:54.648 unset "LC_ALL" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:56.235 WinSCP: this is end-of-file:0
> 2014-02-03 16:04:56.235 unset "HUMAN_BLOCKS" ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:56.786 WinSCP: this is end-of-file:0
. 2014-02-03 16:04:56.787 Looking up groups and users.
> 2014-02-03 16:04:56.787 groups ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:57.606 pg2117988
< 2014-02-03 16:04:57.607 WinSCP: this is end-of-file:0
. 2014-02-03 16:04:57.607 Following groups found:
. 2014-02-03 16:04:57.607 "xxx" [0]
. 2014-02-03 16:04:57.607 Following membership found:
. 2014-02-03 16:04:57.607 "xxxx" [0]
. 2014-02-03 16:04:57.607 No users found.
. 2014-02-03 16:04:57.608 Getting current directory name.
> 2014-02-03 16:04:57.608 pwd ; echo "WinSCP: this is end-of-file:$?"
< 2014-02-03 16:04:58.113 /home/xxxx
< 2014-02-03 16:04:58.113 WinSCP: this is end-of-file:0
. 2014-02-03 16:04:58.113 Startup conversation with host finished.


On another note. How can I check if a parameter has been provided? (i.e does %3% or %4% exist?) If no parameter is provided do nothing else append that too. In dos I would do it this way
IF [%3]==[] GOTO label
martin

Re: Thanks

VijayS wrote:

Another question. The same script, connects to the host 3 times... I don't understand why. Can you explain?

I see only two connections. The main one and the other one for shell session for call commands:
https://winscp.net/eng/docs/scriptcommand_call

Is there a way to connect only once?

Consider using SCP protocol.

and instead of supplying the parameter to the script can I just connect via commandline and just execute the script after?

Not recommended.
VijayS

Thanks

Thanks a tons!! Such a stupid mistake on my part.

Another question. The same script, connects to the host 3 times... I don't understand why. Can you explain? Is there a way to connect only once? and instead of supplying the parameter to the script can I just connect via commandline and just execute the script after?

Also I love that you have anonymous posting enabled for infrequent posters!

Anyway see the cleaned logfile below:
. 2014-01-25 12:00:43.030 --------------------------------------------------------------------------

. 2014-01-25 12:00:43.045 WinSCP Version 4.3.8 (Build 1771) (OS 6.1.7601 Service Pack 1)
. 2014-01-25 12:00:43.048 Login time: Saturday, 25 January, 2014 12:00:43
. 2014-01-25 12:00:43.049 --------------------------------------------------------------------------
. 2014-01-25 12:00:43.049 Session name: example@example.com (Ad-Hoc session)
. 2014-01-25 12:00:43.049 Host name: example.com (Port: 22)
. 2014-01-25 12:00:43.049 User name: example (Password: No, Key file: No)
. 2014-01-25 12:00:43.049 Tunnel: No
. 2014-01-25 12:00:43.049 Transfer Protocol: SFTP (SCP)
. 2014-01-25 12:00:43.049 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2014-01-25 12:00:43.049 Proxy: none
. 2014-01-25 12:00:43.049 SSH protocol version: 2; Compression: No
. 2014-01-25 12:00:43.049 Bypass authentication: No
. 2014-01-25 12:00:43.049 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2014-01-25 12:00:43.049 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2014-01-25 12:00:43.049 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2014-01-25 12:00:43.049 SFTP Bugs: -,-
. 2014-01-25 12:00:43.049 Return code variable: Autodetect; Lookup user groups: Yes
. 2014-01-25 12:00:43.049 Shell: default
. 2014-01-25 12:00:43.049 EOL: 0, UTF: 2
. 2014-01-25 12:00:43.050 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2014-01-25 12:00:43.050 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2014-01-25 12:00:43.050 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2014-01-25 12:00:43.050 Cache directory changes: Yes, Permanent: Yes
. 2014-01-25 12:00:43.050 DST mode: 1
. 2014-01-25 12:00:43.050 --------------------------------------------------------------------------
. 2014-01-25 12:00:43.079 Looking up host "example.com"
. 2014-01-25 12:00:47.219 Connecting to 11.222.111.222 port 22
. 2014-01-25 12:00:51.645 Server version: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2
. 2014-01-25 12:00:51.645 Using SSH protocol version 2
. 2014-01-25 12:00:51.645 We claim version: SSH-2.0-WinSCP_release_4.3.8
. 2014-01-25 12:00:52.060 Doing Diffie-Hellman group exchange
. 2014-01-25 12:00:52.958 Doing Diffie-Hellman key exchange with hash SHA-1
. 2014-01-25 12:00:53.633 Host key fingerprint is:
. 2014-01-25 12:00:53.633 ssh-rsa 2048 1b:88:d0:1c:be:e5:31:be:b7:0a:dd:91:d8:99:d6:12
. 2014-01-25 12:00:53.633 Initialised AES-256 SDCTR client->server encryption
. 2014-01-25 12:00:53.633 Initialised HMAC-SHA1 client->server MAC algorithm
. 2014-01-25 12:00:53.633 Initialised AES-256 SDCTR server->client encryption
. 2014-01-25 12:00:53.633 Initialised HMAC-SHA1 server->client MAC algorithm
. 2014-01-25 12:00:54.527 Pageant is running. Requesting keys.
. 2014-01-25 12:00:54.527 Pageant has 1 SSH-2 keys
! 2014-01-25 12:00:54.528 Using username "example".
. 2014-01-25 12:00:55.009 Trying Pageant key #0
! 2014-01-25 12:00:55.521 Authenticating with public key "SampleKey" from agent
. 2014-01-25 12:00:55.538 Sending Pageant's response
. 2014-01-25 12:00:56.011 Access granted
. 2014-01-25 12:00:56.500 Opened channel for session
. 2014-01-25 12:00:57.613 Started a shell/command
. 2014-01-25 12:00:57.613 --------------------------------------------------------------------------
. 2014-01-25 12:00:57.640 Using SFTP protocol.
. 2014-01-25 12:00:57.642 Doing startup conversation with host.
> 2014-01-25 12:00:57.695 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2014-01-25 12:00:58.123 Type: SSH_FXP_VERSION, Size: 95, Number: -1
. 2014-01-25 12:00:58.124 SFTP version 3 negotiated.
. 2014-01-25 12:00:58.124 Unknown server extension posix-rename@openssh.com="1"
. 2014-01-25 12:00:58.124 Unknown server extension statvfs@openssh.com="2"
. 2014-01-25 12:00:58.124 Unknown server extension fstatvfs@openssh.com="2"
. 2014-01-25 12:00:58.124 We believe the server has signed timestamps bug
. 2014-01-25 12:00:58.124 We will use UTF-8 strings for status messages only
. 2014-01-25 12:00:58.124 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2014-01-25 12:00:58.124 Getting current directory name.
. 2014-01-25 12:00:58.124 Getting real path for '.'
> 2014-01-25 12:00:58.126 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2014-01-25 12:00:58.525 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2014-01-25 12:00:58.526 Real path is '/home/example'
. 2014-01-25 12:00:58.526 Startup conversation with host finished.
< 2014-01-25 12:00:58.526 Script: Active session: [1] example@example.com
> 2014-01-25 12:00:58.527 Script: option transfer binary
< 2014-01-25 12:00:58.528 Script: transfer        binary   
> 2014-01-25 12:00:58.529 Script: call umask 077
< 2014-01-25 12:00:58.529 Script: Searching for host...
. 2014-01-25 12:00:58.530 [Shell] Looking up host "example.com"
. 2014-01-25 12:00:58.536 [Shell] Connecting to 11.222.111.222 port 22
< 2014-01-25 12:00:59.013 Script: Connecting to host...
. 2014-01-25 12:00:59.635 [Shell] Server version: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2
. 2014-01-25 12:00:59.635 [Shell] Using SSH protocol version 2
. 2014-01-25 12:00:59.635 [Shell] We claim version: SSH-2.0-WinSCP_release_4.3.8
. 2014-01-25 12:01:00.103 [Shell] Doing Diffie-Hellman group exchange
. 2014-01-25 12:01:00.970 [Shell] Doing Diffie-Hellman key exchange with hash SHA-1
< 2014-01-25 12:01:01.717 Script: Authenticating...
. 2014-01-25 12:01:01.718 [Shell] Host key fingerprint is:
. 2014-01-25 12:01:01.718 [Shell] ssh-rsa 2048 1b:88:d0:1c:be:e5:31:be:b7:0a:dd:91:d8:99:d6:12
. 2014-01-25 12:01:01.718 [Shell] Initialised AES-256 SDCTR client->server encryption
. 2014-01-25 12:01:01.718 [Shell] Initialised HMAC-SHA1 client->server MAC algorithm
. 2014-01-25 12:01:01.718 [Shell] Initialised AES-256 SDCTR server->client encryption
. 2014-01-25 12:01:01.718 [Shell] Initialised HMAC-SHA1 server->client MAC algorithm
. 2014-01-25 12:01:02.659 [Shell] Pageant is running. Requesting keys.
. 2014-01-25 12:01:02.659 [Shell] Pageant has 1 SSH-2 keys
! 2014-01-25 12:01:02.660 [Shell] Using username "example".
< 2014-01-25 12:01:02.660 Script: Using username "example".
. 2014-01-25 12:01:03.135 [Shell] Trying Pageant key #0
! 2014-01-25 12:01:04.236 [Shell] Authenticating with public key "SampleKey" from agent
< 2014-01-25 12:01:04.236 Script: Authenticating with public key "SampleKey" from agent.
. 2014-01-25 12:01:04.259 [Shell] Sending Pageant's response
. 2014-01-25 12:01:04.639 [Shell] Access granted
. 2014-01-25 12:01:05.012 [Shell] Opened channel for session
. 2014-01-25 12:01:05.784 [Shell] Started a shell/command
< 2014-01-25 12:01:05.784 Script: Authenticated.
. 2014-01-25 12:01:05.785 [Shell] --------------------------------------------------------------------------
. 2014-01-25 12:01:05.785 [Shell] Using SCP protocol.
. 2014-01-25 12:01:05.785 [Shell] Doing startup conversation with host.
< 2014-01-25 12:01:05.785 Script: Starting the session...
. 2014-01-25 12:01:05.786 [Shell] Skipping host startup message (if any).
> 2014-01-25 12:01:05.787 [Shell] echo "WinSCP: this is end-of-file:0"
< 2014-01-25 12:01:05.787 [Shell]  Welcome to example.com
< 2014-01-25 12:01:05.787 [Shell] Any malicious and/or unauthorized activity is strictly forbidden.
< 2014-01-25 12:01:05.787 [Shell] All activity may be logged by DreamHost Web Hosting.
< 2014-01-25 12:01:06.646 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:06.646 [Shell] Detecting variable containing return code of last command.
. 2014-01-25 12:01:06.646 [Shell] Trying "$status".
> 2014-01-25 12:01:06.646 [Shell] echo "$status" ; echo "WinSCP: this is end-of-file:0"
< 2014-01-25 12:01:07.480 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:07.480 [Shell] The response is not numerical exit code
. 2014-01-25 12:01:07.481 [Shell] Trying "$?".
> 2014-01-25 12:01:07.482 [Shell] echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 2014-01-25 12:01:08.262 [Shell] 0
< 2014-01-25 12:01:08.262 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:08.262 [Shell] Return code variable "$?" selected.
< 2014-01-25 12:01:08.262 Script: Reading remote directory...
. 2014-01-25 12:01:08.263 [Shell] Changing directory to "/home/example".
> 2014-01-25 12:01:08.263 [Shell] cd "/home/example" ; echo "WinSCP: this is end-of-file:$?"
< 2014-01-25 12:01:09.181 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:09.181 [Shell] Getting current directory name.
> 2014-01-25 12:01:09.181 [Shell] pwd ; echo "WinSCP: this is end-of-file:$?"
< 2014-01-25 12:01:10.004 [Shell] /home/example
< 2014-01-25 12:01:10.004 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:10.004 [Shell] Startup conversation with host finished.
< 2014-01-25 12:01:10.004 Script: Session started.
. 2014-01-25 12:01:10.006 Executing user defined command on command session.
> 2014-01-25 12:01:10.007 [Shell] umask 077 ; echo "WinSCP: this is end-of-file:$?"
< 2014-01-25 12:01:10.976 [Shell] WinSCP: this is end-of-file:0
> 2014-01-25 12:01:10.976 [Shell] pwd ; echo "WinSCP: this is end-of-file:$?"
< 2014-01-25 12:01:11.816 [Shell] /home/example
< 2014-01-25 12:01:11.816 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:11.816 Cached directory change via "/home/example" to "/home/example".
. 2014-01-25 12:01:11.818 Getting current directory name.
. 2014-01-25 12:01:11.818 Getting current directory name.
> 2014-01-25 12:01:11.819 Script: call test -d .ssh || mkdir .ssh
. 2014-01-25 12:01:11.819 Executing user defined command on command session.
> 2014-01-25 12:01:11.819 [Shell] test -d .ssh || mkdir .ssh ; echo "WinSCP: this is end-of-file:$?"
< 2014-01-25 12:01:12.694 [Shell] WinSCP: this is end-of-file:0
> 2014-01-25 12:01:12.694 [Shell] pwd ; echo "WinSCP: this is end-of-file:$?"
< 2014-01-25 12:01:13.550 [Shell] /home/example
< 2014-01-25 12:01:13.550 [Shell] WinSCP: this is end-of-file:0
. 2014-01-25 12:01:13.550 Cached directory change via "/home/example" to "/home/example".
. 2014-01-25 12:01:13.550 Getting current directory name.
. 2014-01-25 12:01:13.550 Getting current directory name.
> 2014-01-25 12:01:13.550 Script: put -append .\ExternalTools\id_rsa.pub .ssh/authorized_keys
. 2014-01-25 12:01:13.551 Copying 1 files/directories to remote directory ".ssh/"
. 2014-01-25 12:01:13.551   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: authorized_keys
. 2014-01-25 12:01:13.551   TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2014-01-25 12:01:13.551   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2014-01-25 12:01:13.551 File: ".\ExternalTools\id_rsa.pub"
. 2014-01-25 12:01:13.559 Copying ".\ExternalTools\id_rsa.pub" to remote directory started.
. 2014-01-25 12:01:13.559 Binary transfer mode selected.
. 2014-01-25 12:01:13.559 Opening remote file.
> 2014-01-25 12:01:13.560 Type: SSH_FXP_OPEN, Size: 61, Number: 259
< 2014-01-25 12:01:14.009 Type: SSH_FXP_STATUS, Size: 24, Number: 259
< 2014-01-25 12:01:14.009 Status code: 4, Message: 259, Server: Failure, Language: 
> 2014-01-25 12:01:14.010 Type: SSH_FXP_LSTAT, Size: 45, Number: 519
< 2014-01-25 12:01:14.385 Type: SSH_FXP_ATTRS, Size: 37, Number: 519
> 2014-01-25 12:01:14.432 Type: SSH_FXP_OPEN, Size: 53, Number: 771
< 2014-01-25 12:01:14.806 Type: SSH_FXP_HANDLE, Size: 13, Number: 771
. 2014-01-25 12:01:14.806 Appending file.
> 2014-01-25 12:01:14.808 Type: SSH_FXP_WRITE, Size: 234, Number: 1286
> 2014-01-25 12:01:14.808 Type: SSH_FXP_CLOSE, Size: 13, Number: 1540
> 2014-01-25 12:01:14.808 Type: SSH_FXP_SETSTAT, Size: 57, Number: 1033
< 2014-01-25 12:01:15.184 Type: SSH_FXP_STATUS, Size: 24, Number: 1286
< 2014-01-25 12:01:15.588 Type: SSH_FXP_STATUS, Size: 24, Number: 1540
< 2014-01-25 12:01:15.588 Status code: 0
< 2014-01-25 12:01:15.588 Type: SSH_FXP_STATUS, Size: 24, Number: 1033
< 2014-01-25 12:01:15.621 Status code: 0
> 2014-01-25 12:01:15.624 Script: close
. 2014-01-25 12:01:15.624 Closing connection.
. 2014-01-25 12:01:15.624 Sending special code: 12
. 2014-01-25 12:01:15.624 Sent EOF message
. 2014-01-25 12:01:15.625 [Shell] Closing connection.
. 2014-01-25 12:01:15.625 [Shell] Sending special code: 12
. 2014-01-25 12:01:15.625 [Shell] Sent EOF message
martin

Re: Variables not getting replaced

It's /parameter, not /parameters.
VijayS

Variables not getting replaced

The log shows that %1% and %2% don't get replaced by the parameters provided. Can you help?

# WINSCP script


# example commandline arguments from mremoteNG
# WinSCP.com"  /script=".\ExternalTools\ssh-copy-id.txt" /parameters "%username%:%password%@%hostname%" ".\ExternalTools\id_rsa.pub" /log=".\ExternalTools\copyssh.log"
# test commandline
# WinSCP.com"  /script=".\ExternalTools\ssh-copy-id.txt" /parameters "example:pwd@domain.com" ".\ExternalTools\id_rsa.pub" /log=".\ExternalTools\copyssh.log"

#Thu January 23, 2014 08:52:23 PM
# not working so far, as the %2% is not getting properly converted somehow


option batch on
option confirm off
open %1%
option transfer binary

call umask 077
call test -d .ssh || mkdir .ssh
put -append %2% .ssh/authorized_keys
close
exit