My problem is that i either has to know why this line doesent work:
"C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\WinSCP\winscp.exe" /command "option confirm off" "open sftp://MEDICONKUNDEN@84.16.232.20:1970" "-privatekey=C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\MEDICONKUNDEN.ppk" "put C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\Archive_20131009_151707.zip \HOME\MEDICONKUNDEN\" "/log=C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\log_justupload.txt"
. 2013-10-10 14:03:40.583 --------------------------------------------------------------------------
. 2013-10-10 14:03:40.583 WinSCP Version 5.1.7 (Build 3446) (OS 5.2.3790 Service Pack 2)
. 2013-10-10 14:03:40.583 Configuration: C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\WinSCP\WinSCP.ini
. 2013-10-10 14:03:40.583 Local account: CENSORED
. 2013-10-10 14:03:40.583 Working directory: C:\Dokumente und Einstellungen\Administrator\Desktop\Temp
. 2013-10-10 14:03:40.583 Process ID: 3744
. 2013-10-10 14:03:40.583 Command-line: "C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\WinSCP\winscp.exe" /command "option confirm off" "open sftp://CENSORED@CENSORED:CENSORED" "-privatekey=C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\CENSORED.ppk" "put C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\Archive_20131009_151707.zip \HOME\CENSORED\" "/log=C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\log_justupload.txt"
. 2013-10-10 14:03:40.583 Time zone: Current: GMT+2, Standard: GMT+1, DST: GMT+2, DST Start: 31.03.2013, DST End: 27.10.2013
. 2013-10-10 14:03:40.583 Login time: Donnerstag, 10. Oktober 2013 14:03:40
. 2013-10-10 14:03:40.583 --------------------------------------------------------------------------
. 2013-10-10 14:03:40.583 Session name: put C (Ad-Hoc session)
. 2013-10-10 14:03:40.583 Host name: put C (Port: -1)
. 2013-10-10 14:03:40.583 User name: (Password: No, Key file: Yes)
. 2013-10-10 14:03:40.583 Tunnel: No
. 2013-10-10 14:03:40.583 Transfer Protocol: SFTP (SCP)
. 2013-10-10 14:03:40.583 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2013-10-10 14:03:40.583 Proxy: none
. 2013-10-10 14:03:40.583 SSH protocol version: 2; Compression: No
. 2013-10-10 14:03:40.583 Bypass authentication: No
. 2013-10-10 14:03:40.583 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2013-10-10 14:03:40.583 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2013-10-10 14:03:40.583 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2013-10-10 14:03:40.583 Return code variable: Autodetect; Lookup user groups: A
. 2013-10-10 14:03:40.583 Shell: default
. 2013-10-10 14:03:40.583 EOL: 0, UTF: 2
. 2013-10-10 14:03:40.583 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2013-10-10 14:03:40.583 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2013-10-10 14:03:40.583 SFTP Bugs: A,A
. 2013-10-10 14:03:40.583 SFTP Server: default
. 2013-10-10 14:03:40.583 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2013-10-10 14:03:40.583 Cache directory changes: Yes, Permanent: Yes
. 2013-10-10 14:03:40.583 DST mode: 1; Timezone offset: 0h 0m
. 2013-10-10 14:03:40.583 --------------------------------------------------------------------------
. 2013-10-10 14:03:40.583 Looking up host "put C"
. 2013-10-10 14:03:53.833 --------------------------------------------------------------------------
. 2013-10-10 14:03:53.833 WinSCP Version 5.1.7 (Build 3446) (OS 5.2.3790 Service Pack 2)
. 2013-10-10 14:03:53.833 Configuration: C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\WinSCP\WinSCP.ini
. 2013-10-10 14:03:53.833 Local account: CENSORED
. 2013-10-10 14:03:53.833 Working directory: C:\Dokumente und Einstellungen\Administrator\Desktop\Temp
. 2013-10-10 14:03:53.833 Process ID: 3744
. 2013-10-10 14:03:53.833 Command-line: "C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\WinSCP\winscp.exe" /command "option confirm off" "open sftp://CENSORED@CENSORED:CENSORED" "-privatekey=C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\CENSORED.ppk" "put C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\Archive_20131009_151707.zip \HOME\FOLDER\" "/log=C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\log_justupload.txt"
. 2013-10-10 14:03:53.833 Time zone: Current: GMT+2, Standard: GMT+1, DST: GMT+2, DST Start: 31.03.2013, DST End: 27.10.2013
. 2013-10-10 14:03:53.833 Login time: Donnerstag, 10. Oktober 2013 14:03:53
. 2013-10-10 14:03:53.833 --------------------------------------------------------------------------
. 2013-10-10 14:03:53.833 Session name: CENSORED@CENSORED (Ad-Hoc session)
. 2013-10-10 14:03:53.833 Host name: CENSORED (Port: CENSORED)
. 2013-10-10 14:03:53.833 User name: CENSORED (Password: No, Key file: No)
. 2013-10-10 14:03:53.833 Tunnel: No
. 2013-10-10 14:03:53.833 Transfer Protocol: SFTP
. 2013-10-10 14:03:53.833 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2013-10-10 14:03:53.833 Proxy: none
. 2013-10-10 14:03:53.833 SSH protocol version: 2; Compression: No
. 2013-10-10 14:03:53.833 Bypass authentication: No
. 2013-10-10 14:03:53.833 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2013-10-10 14:03:53.833 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2013-10-10 14:03:53.833 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2013-10-10 14:03:53.833 Return code variable: Autodetect; Lookup user groups: A
. 2013-10-10 14:03:53.833 Shell: default
. 2013-10-10 14:03:53.833 EOL: 0, UTF: 2
. 2013-10-10 14:03:53.833 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2013-10-10 14:03:53.833 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2013-10-10 14:03:53.833 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2013-10-10 14:03:53.833 Cache directory changes: Yes, Permanent: Yes
. 2013-10-10 14:03:53.833 DST mode: 1; Timezone offset: 0h 0m
. 2013-10-10 14:03:53.833 --------------------------------------------------------------------------
. 2013-10-10 14:03:53.833 Looking up host "CENSORED"
. 2013-10-10 14:03:53.833 Connecting to CENSORED port CENSORED
. 2013-10-10 14:03:54.052 Server version: SSH-2.0-OpenSSH_4.3
. 2013-10-10 14:03:54.052 Using SSH protocol version 2
. 2013-10-10 14:03:54.052 We claim version: SSH-2.0-WinSCP_release_5.1.7
. 2013-10-10 14:03:54.145 Doing Diffie-Hellman group exchange
. 2013-10-10 14:03:54.411 Doing Diffie-Hellman key exchange with hash SHA-1
. 2013-10-10 14:03:54.958 Verifying host key rsa2 CENSORED with fingerprint ssh-rsa 2048 CENSORED
. 2013-10-10 14:03:54.958 Host key matches cached key
. 2013-10-10 14:03:54.958 Host key fingerprint is:
. 2013-10-10 14:03:54.958 ssh-rsa 2048 CENSORED
. 2013-10-10 14:03:54.958 Initialised AES-256 SDCTR client->server encryption
. 2013-10-10 14:03:54.958 Initialised HMAC-SHA1 client->server MAC algorithm
. 2013-10-10 14:03:54.958 Initialised AES-256 SDCTR server->client encryption
. 2013-10-10 14:03:54.958 Initialised HMAC-SHA1 server->client MAC algorithm
. 2013-10-10 14:03:55.270 Reading private key file "C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\CENSORED.ppk"
! 2013-10-10 14:03:55.270 Using username "CENSORED".
. 2013-10-10 14:03:55.333 Offered public key
. 2013-10-10 14:03:55.708 Offer of public key accepted
! 2013-10-10 14:03:55.708 Authenticating with public key "imported-openssh-key"
. 2013-10-10 14:03:56.052 Sent public key signature
. 2013-10-10 14:03:56.364 Access granted
. 2013-10-10 14:03:56.520 Opened channel for session
. 2013-10-10 14:03:56.848 Started a shell/command
. 2013-10-10 14:03:56.848 --------------------------------------------------------------------------
. 2013-10-10 14:03:56.848 Using SFTP protocol.
. 2013-10-10 14:03:56.848 Doing startup conversation with host.
> 2013-10-10 14:03:56.848 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2013-10-10 14:03:57.286 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2013-10-10 14:03:57.286 SFTP version 3 negotiated.
. 2013-10-10 14:03:57.286 We believe the server has signed timestamps bug
. 2013-10-10 14:03:57.286 We will use UTF-8 strings for status messages only
. 2013-10-10 14:03:57.286 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2013-10-10 14:03:57.286 Getting current directory name.
. 2013-10-10 14:03:57.286 Getting real path for '.'
> 2013-10-10 14:03:57.286 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2013-10-10 14:03:57.380 Type: SSH_FXP_NAME, Size: 59, Number: 16
. 2013-10-10 14:03:57.380 Real path is '/home/CENSORED'
. 2013-10-10 14:03:57.380 Startup conversation with host finished.
< 2013-10-10 14:03:57.380 Script: Active session: [1] CENSORED@CENSORED
. 2013-10-10 14:03:57.380 Script: Exit code: 1
. 2013-10-10 14:03:57.380 Closing connection.
. 2013-10-10 14:03:57.380 Sending special code: 12
. 2013-10-10 14:03:57.380 Sent EOF message
or that i need an example how i can get a variable in the script. Something like that:
(I dont think that this will work but how can i get the %archive% variable from the batch script in the winscp script file?)
set archive=NameOfData.zip
start "C:\Temp\" winscp.exe /console /script=Script.txt /%archive%"
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open sftp://CENSORED@xx.xx.xx.xx:xxxx -privatekey="C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\PRIVATEKEYFILE.ppk"
# Change remote directory
cd \HOME\FOLDER\
# Change the Local Directory
lcd "C:\Dokumente und Einstellungen\Administrator\Desktop\Temp\"
# Force binary mode transfer
option transfer binary
# Upload the files to current working directory
put "%archive%"
# Disconnect
close
# Exit WinSCP
exit