Check the current version in a BAT?
So far, the only way I've found to get the WinSCP version number in a batch file is to open a connection and close it, then look at the log. Like this...
Most env vars are self-explanatory.
I guess the question is, is there a way to get the version number from the command line without going through all this, or, if not, is there a way to get WinSCP to generate a log file without actually opening a connection? I'd like to speed this up...
set SCPMAJ_REQ=5 set SCPMIN_REQ=13 %WINSCP% %SCP_PAR% call :check_log for /f "usebackq tokens=6,7 delims=.() " %%a in ( `findstr /c:"WinSCP Version" %SCPLOG%` ) do ( set SCPMAJ_VER=%%a set SCPMIN_VER=%%b ) if /i %SCPMAJ_VER% EQU %SCPMAJ_REQ% if /i %SCPMIN_VER% LSS %SCPMIN_REQ% set BADVER=TRUE if /i %SCPMAJ_VER% LSS %SCPMAJ_REQ% set BADVER=TRUE if defined BADVER ( echo [E] WinSCP is not the correct version. It must be at least %SCPMAJ_REQ%.%SCPMIN_REQ% echo and is actually %SCPMAJ_VER%.%SCPMIN_VER% call :winscp_bad goto :exitlogic ) else ( if /i %DEBUG% GEQ 3 echo [D] WinSCP Version %SCPMAJ_VER%.%SCPMIN_VER% )
SCP_PAR
(for parameters) is, in this case, /script=[script] /log=%SCPLOG%
. The two other calls are just a quick explanation to the user of how to install (:winscp_bad
) and looking for basic problems, like no connection, bad password, etc (:check_log
)
I guess the question is, is there a way to get the version number from the command line without going through all this, or, if not, is there a way to get WinSCP to generate a log file without actually opening a connection? I'd like to speed this up...