Martin,
I wasn't able to find this on anywhere in docs.
The only way I was able to find to get WinSCP version is to run:
This will output on the first line WinSCP version.
WinSCP, Version 5.9.3 (Build 7136)
Copyright (c) 2000-2016 Martin Prikryl
Usage:
WinSCP [/script=file] [/command cmd1...] [/parameter // param1...]
...
...
I have just met with the requirement to check WinSCP version in scripting.
For example if someone is trying to run old version which doesn't support some command or trying to run
incompatibility version then, for example, stop him.
The best way to do this one is to have in
Command-line Options a parameter like:
/rawversion
(may be also
/version
).
Also we can have this one in
Scripting and Task Automation - Commands.
rawversion
has to display it in raw way like: 50903 or may be 7136 (assuming that build version is always increasing).
and
version
has to display it in human way like: WinSCP, Version 5.9.3 (Build 7136)
The best close example for such command is in PHP.
They use
PHP_VERSION_ID and I can check very easily:
if (PHP_VERSION_ID < 50100) {
//do one thing
}else{
//do another thing
}
or
if (PHP_VERSION_ID < 50207) {
define('PHP_MAJOR_VERSION', $version[0]);
define('PHP_MINOR_VERSION', $version[1]);
define('PHP_RELEASE_VERSION', $version[2]);
// and so on, ...
}
// PHP_VERSION_ID is defined as a number, where the higher the number
// is, the newer a PHP version is used. It's defined as used in the above
// expression:
//
$version_id = $major_version * 10000 + $minor_version * 100 + $release_version;
For example I have PHP 5.6.19
print PHP_VERSION_ID;
will give me
50619
Thank you!