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: command prompt won't exit

You have a tab character at the end of the mv line:
    "mv *.txt Archive/" ^   

It breaks the line spanning in the batch file:
https://winscp.net/eng/docs/faq_batch_file#newline_escaping

Edit: Ok, I didn't notice that you have resolved this on your own :)
david@affordabledbs.net

Found my error

Found the error. had a space after one of the ^
david@affordabledbs.net

command prompt won't exit

I have a batch file that runs and completes, but the command prompt will not exit, I have the exit command there, but I still end up with winscp> with an open command prompt. Below is my script. I've xxxx out all the FTP site info. I've also included a picture. What am I missing?
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\Temp\WinSCPLog\!S.log" /ini=nul ^
  /command ^
    "open sftp://xxxxxx:xxxxxxxxx@mysftp.com/ -hostkey=""xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=""" ^
    "lcd C:\Temp\POFILE" ^
    "cd /IN" ^
    "get *.txt" ^
    "mv *.txt Archive/" ^   
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%