WinSCP批处理脚本 - %ERRORLEVEL%always = 0?

时间:2016-03-01 18:43:01

标签: batch-file winscp

REM --- ### FTP_Batch ### ---

@echo off

REM获取第一行记录并存储在%% A

setlocal enableDelayedExpansion
for /F "tokens=*" %%A in (FTP_Account_with_Password_and_EOL.txt) do (

REM使用%% A作为开放连接运行WinSCP

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="c:\temp\WinSCP.log" /loglevel=1 /ini=nul ^
    /command ^
    "%%A" ^
    "ls" ^
    "exit"
%WINSCP_RESULT% = %ERRORLEVEL%

    if %ERRORLEVEL% neq 0 (
      echo Error 
      echo %ERRORLEVEL% %%A 

    ) else (
      echo Success %ERRORLEVEL% %%A 
      echo Winscp Result %WINSCP_RESULT%
    )
    pause
    )

ENDLOCAL
exit /b %WINSCP_RESULT%

0 个答案:

没有答案