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

Advertisement

captainkatz
Joined:
Posts:
1
Location:
no where

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%

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

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).

Reply with quote

Advertisement

You can post new topics in this forum