Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: shell commands

Command "call" (or "!") is supported since 3.7.5 only.

BTW, you cannot use custom commands in script.
daAgent

shell commands

Hi there,
I'm new to winscp and would like to use it for a simple script (with the /console and /script options). This is what the script is like:
################
option batch on
option confirm off
cd /desired/directory
option transfer ascii
put someFiles*
option transfer binary
put anotherfile
close
exit
################

This works very well, but if I want to execute shell commands I don't get it. What I want is something like:
################
option batch on
option confirm off
cd /desired/directory
option transfer ascii
put someFiles*
option transfer binary
put anotherfile

tar cf - someFiles* | gzip > someFiles.tgz

close
exit
################

I found in the forum and some documentation that it is possible to use custom commands but I did not find how to define and how to use them. And I found that things like
cp ! /backup/!`date +%Y%m%d`
should be possible, but again I didn't find the syntax explanation.
I tried
! tar cf - someFiles* | gzip > someFiles.tgz
and
"!" tar cf - someFiles* | gzip > someFiles.tgz

but I always get the error that the command "!" is unknown.

I'm using winscp374.exe (the standalone application download).

Could you please explain the syntax to me and at best give me an example how to use an shell command in such a script.

Many thanks