Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: CMD Confirm. Prompt Issue When Connecting to FTP (explicit) With a IP address for the Hostname.

The -certificate switch should take care of that. Please attach a full session log file showing the problem (using the latest version of WinSCP). Do not mask out the certificate fingerprints (it's not a sensitive information).
captainkatz

CMD Confirm. Prompt Issue When Connecting to FTP (explicit) With a IP address for the Hostname.

Hello all, I am having some issues while trying to automate a batch file to connect to a FTP (explicit). The issue seems to steam from the Certificate being self-signed and the hostname being a IP address. I ran the program manually and entered (Y) to trust the certificate multiple times but no luck.

I've also tried to enter echo y or echo y | [command] in multiple places on the batch file, but no luck as well. I think Windows might be forcing the user to give input instead of taking commands from the batch file.

I am quite new to FTP's and batch files so any advise would be greatly appreciated.
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\folder\Program\WinSCP_program_PUSH_PULL.log" /ini=nul ^
  /command ^
    "open ftpes://USER:PASS@***.***.***.***/ -certificate=""**:**:**:**:**:**:**:**:""" ^
    "cd Folder" ^
    "cd Subfolder" ^
    "get *.* -delete c:\Folder\Subfolder\" ^
    "cd .." ^
    "cd Subfolder2" ^
    "lcd c:\Folder2\Subfolder2" ^
    "put * -delete" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
rem move /Y c:\Folder\Subfolder\*.* \\***.***.***.***\subfolder\
rem --Upload photos
 
exit /b %WINSCP_RESULT%