Post a reply

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)


Topic review


That makes sense. Some of the files in .csv file are not in the ftp folder. Does the script stop when it encounters and error for file not found?

Re: Batch File reading text file issue

Generate WinSCP script in your loop (append new get command in each iteration), and execute WinSCP only once at the end.

Batch File reading text file issue

for /f "usebackq tokens=*" %%x in (ptest.csv) do ( 
echo Starting WinSCP /log=C:\Logs\winscp.log /ini=nul /command ^
    "open s -hostkey=""ecdsa-sha2-nistp256 256 blah blah=""" ^
    "lcd ""C:\Images""" ^
    "get %%x.JPG" ^
echo WinSCP finished

Above is the batch file I am using to open a text file and read each line into a variable. I am then taking the variable adding .jpg to the name and pulling it down form the server. This works, but I am logging in for each new line in the text file. Is there a way I can put the credential in once and the loop through the file until complete?