
WinSCP 스크립팅을 사용하여 일부 파일 전송을 자동화하려고 합니다. 이것이 내가 가진 것입니다.
option echo off
option batch on
option confirm off
open abcde:[email protected]
lcd "t:\"
put -nopermissions -nopreservetime "test.txt" test.txt
exit
실제로 명령줄로 이동하여 문제 없이 , 및 명령을 open
실행할 lcd
수 있습니다. put
스크립트를 사용할 때 다음 오류가 발생합니다.
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Host "=" does not exist.
스크립트를 끌어오는 배치 파일에 연결 명령을 넣어 연결 문제를 해결했습니다.
Winscp.com abcde:[email protected]
나머지 작업을 실행하기 위해 스크립트를 어떻게 호출합니까?
답변1
당신은 당신을 저장해야합니다WinSCP 스크립트파일로(예 script.txt
: )
그런 다음 WinSCP가 다음을 사용하여 스크립트를 실행하도록 만듭니다./script=
명령줄 스위치, 좋다:
winscp.com /log=winscp.log /script=script.txt
답변2
이것은 나에게 효과적이었습니다. 다음 텍스트를 .bat 파일로 저장하고 실행했습니다.
echo off
WinScp /ini=nul /command "open [email protected] -
privatekey=D:\PostgresXL.ppk" "move_files_or_do_something" "exit"