Topic "Run silently"

Author Message
Jayp
[View user's profile]

Joined: 2012-11-19
Posts: 4
No doubt this is a FAQ somewhere but I can't find it sorry.
I have inherited a windows scheduled task that runs Winscp - I know have to transfer this to a new server.
I've followed as much as I can to recreate the environment but I can't get past this bit. It seems the connection is asking me to select yes/no/cancel at some stage during the automation and I'm not sure how to get rid of the prompts.
The log says...

If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache? ()

and the task just sits and waits.
I'm not sure how to specify "yes" and have this remembered so that the task can run silently.
I'm using version 3.8.2
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
First, you really need to upgrade!

Then, read the documentation:
http://winscp.net/eng/docs/ssh#verifying_the_host_key
_________________
Martin Prikryl
Jayp
[View user's profile]

Joined: 2012-11-19
Posts: 4
Thanks, still missing something and not sure why.
The sceduled task runs and fires up the script, connection is made (assumption), transfer does NOT happen and the local files are then moved to the completed folder. Nothing is logged so I cannot see what is not happening.

Run WinSCP.cmd
CD "C:\T1\NDD\"
winscp3.exe /console /script="NDD_SSH.txt" /log="log/&Y&M&D&T&S.log" /open <removed for privacy>
move "C:\T1\NDD\NDD XML output\*.xml" "C:\T1\NDD\NDD XML output\complete\"
exit

NDD_SSH.txt
option batch abort
open <removed for privacy> -hostkey="ssh-rsa 2048 86:17:7e:96:8d:22:22:dd:7c:98:f7:35:31:9c:37:98"
ls *.*
lcd "C:\T1\NDD\NDD XML Output"
put *.xml
ls *.*
close
exit


logging window screenshot attatched
logging.png (25.34 KB) [Download]

Description: log

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Jayp wrote:
Thanks, still missing something and not sure why.
The sceduled task runs and fires up the script, connection is made (assumption), transfer does NOT happen and the local files are then moved to the completed folder. Nothing is logged so I cannot see what is not happening.

Run WinSCP.cmd
CD "C:\T1\NDD\"
winscp3.exe /console /script="NDD_SSH.txt" /log="log/&Y&M&D&T&S.log" /open <removed for privacy>
move "C:\T1\NDD\NDD XML output\*.xml" "C:\T1\NDD\NDD XML output\complete\"
exit

NDD_SSH.txt
option batch abort
open <removed for privacy> -hostkey="ssh-rsa 2048 86:17:7e:96:8d:22:22:dd:7c:98:f7:35:31:9c:37:98"
ls *.*
lcd "C:\T1\NDD\NDD XML Output"
put *.xml
ls *.*
close
exit


logging window screenshot attatched

1) winscp3.exe suggests you might be using an ancient version of WinSCP (thought the screenshot looks quite new). So first, make sure you get the latest one.
2) Use winscp.com, not winscp.exe.
See why: http://winscp.net/eng/docs/executables
3) Better use full path with /log and backslashes, not slashes (it's local path!)
4) There's no /open command-line parameter. And it seems redundant to open command in the script anyway, please remote it.
Jayp
[View user's profile]

Joined: 2012-11-19
Posts: 4
I'm (now) using the .com that is in the same folder as the exe. The version of the exe is 5.1.1 build 2735.
I can't see a way to determine the version of the .com but as it's in the same install folder I assume it's the latest.

I have changed my 2 files to be:
CD "C:\T1\NDD\"
winscp3.com /console /script="C:\T1\NDD\NDD_SSH.txt" /log="C:\T1\NDD\log\&Y&M&D&T&S.log"
move "C:\T1\NDD\NDD XML output\*.xml" "C:\T1\NDD\NDD XML output\complete\"
exit

and
option batch abort
open <hidden> -hostkey="ssh-rsa 2048 86:17:7e:96:8d:22:22:dd:7c:98:f7:35:31:9c:37:98"
ls *.*
lcd "C:\T1\NDD\NDD XML Output"
put *.xml
ls *.*
close
exit


Still no success. No logging. No files received at remote end. Files ARE transferred locally to the "complete" folder
Jayp
[View user's profile]

Joined: 2012-11-19
Posts: 4
Well after looking everywhere for a possible cause I decided to do something which I should have done to begin with!
I put a pause in the cmd script so I could see the output from the command prompt.
winscp3.com is not a recognised file.
oops! where did I get the 3 from?
Changed to winscp.com and all works perfectly now
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