trying to call a batch file within another batch file the script completes the synchronization of the remote folders but then fails to call the other batch file.
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Test\TestLog.log" /ini=nul ^
/command ^
"open sftp://test/ -hostkey=""ssh-dss 2048 xxxxxxxxxxxxxxxxxxxxxxxxx=""" ^
"synchronize remote \\Please\Send\Some\Help /Dir/Test" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
CALL movefile
pause
Simply move the call command to be above the exit command or else it will exit before calling.
This. . .
exit /b %WINSCP_RESULT%
CALL movefile
pause
Becomes this. . .
CALL movefile
pause
exit /b %WINSCP_RESULT%
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Test\TestLog.log" /ini=nul ^
/command ^
"open sftp://test/ -hostkey=""ssh-dss 2048 xxxxxxxxxxxxxxxxxxxxxxxxx=""" ^
"synchronize remote \\Please\Send\Some\Help /Dir/Test" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
CALL movefile
pause
exit /b %WINSCP_RESULT%
Note: You will also want to ensure the batch script file being called actually exists so confirm that is the accurate location from the executing batch script command that calls
movefile
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다