Topic "First steps in scripting"

Author Message
Yves

Guest


Hi,

i have tried my first steps in scripting but i was not successfull.

I used the sample script and changed it a little bit like this:

script.scp

Code:

# 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 password
# open user:password@example.com
# Connect
open myuser:mypassword@myhost
# Change remote directory
cd /folder
# Force binary mode transfer
option transfer binary
# Download file to the local directory c:\
get config.h c:\
# Disconnect
close
# Exit WinSCP
exit


To execute it i used to following command:

c:\programme\winscp3\WinSCP3.com /console /script=script.scp

After this a window has opened and closed fast.

A manual connect by winscp is possible.

Whats my mistake? Confused

Thanks for help!
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Run the script from already opened console window (type 'cmd' into start/run box) to keep the results once the script finishes.
_________________
Martin Prikryl
Yves

Guest


Hi,

thanks for your replay.

I get the error message

Code:
Cannot open file script.scp


The script is in the WinSCP folder.
Yves

Guest


ok, my fault.

Now I get the following:
Code:

C:\Programme\WinSCP3>
batch        on
confirm      off
EAccessViolation
Keine Sitzung
transfer     binary
Keine Sitzung
Keine Sitzung
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
You probably use 3.8 beta. Please downgrade to stable version 3.7.6.
_________________
Martin Prikryl
Christoph

Guest


Hello all

Using Win2000 I'm facing the same issue: Using plain command "winscp3.exe /console /script=connect.txt" from command line is showing same result as Yves is reporting (while script-file is an adapted copy from the documentation-site). I went done to 3.7.6 as recommended but no change.
What I found interesting is the fact that the script command is not listed when typing help on the console (started with winscp3.exe /console). Does this ev. have any meaning or did I somehow miss an important part in the documentation? Thanks for your efforts

/Christoph, Berne-CH
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
So you also get the "EAccessViolation" error?
_________________
Martin Prikryl
Christoph

Guest


Hi Martin

Well, one has to differntiate:

- "winscp3.exe /console /script=c:\programme\winscp3\connect.txt" is resulting in that very short popping window Yves already mentioned while

- "winscp3.com /console /script=c:\programme\winscp3\connect.txt" results in the error message "cannot open file c:\programme\winscp3\connect.txt"

Moreover: "winscp3.com xxx@host.tdl /console (xxx@host.tdl is the default session in the GUI) is properly opening the session ending with the command line on the console; the same with .exe instead of .com just with the difference an addition window is opened.

So, what about that error-message; do you have an idea?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Christoph wrote:
So, what about that error-message; do you have an idea?

I guess that it is pointless to ask you whether the file really exists and whether you have read access to the file Smile
_________________
Martin Prikryl
Christoph

Guest


Martin,

I really have to appologize! The file does exist but it's named connect.txt.txt (some remaining typing from the old days with DOS; that's what's happening if project managers try to work outside their core competences ...).
Long story short: It's working fine now

Again sorry about that and thanks for following up on this anyway!
/Christoph
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