for /f "usebackq tokens=*" %%x in (ptest.csv) do ( echo Starting WinSCP winscp.com /log=C:\Logs\winscp.log /ini=nul /command ^ "open sftp://xxx:email@example.com/ -hostkey=""ecdsa-sha2-nistp256 256 blah blah=""" ^ "lcd ""C:\Images""" ^ "cd ""/BBIMAGES/LINKS_SPRIDENID""" ^ "get %%x.JPG" ^ "exit" 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?