I am trying to retrieve a particular file from multiple FTP servers. those server details are stored in Excel file. So I am writing VBA code to generate a .bat file.
Code:
Const script = "C:\Users\xyz.abc\trial.bat"
Dim fileno As Integer
Dim retval As Variant
fileno = FreeFile
Open script For Output As #fileno
Dim i As Integer
Print #fileno, "open " & Cells(2, 2).Value 'server ip
Print #fileno, Cells(2, 3).Value 'username
Print #fileno, Cells(2, 4).Value 'password
Print #fileno, "cd " & Cells(2, 5).Value 'path
Print #fileno, "get " & Cells(2, 6).Value 'filename
Print #fileno, "bye"
Print #fileno, "open " & Cells(3, 2).Value 'server ip
Print #fileno, Cells(3, 3).Value 'username
Print #fileno, Cells(3, 4).Value 'password
Print #fileno, "cd " & Cells(3, 5).Value 'path
Print #fileno, "get " & Cells(3, 6).Value 'filename
Print #fileno, "bye"
Close #fileno
The problem I am facing is it is logging to the first server, retrieving file and then stopping. It's not going on to next server login. Individually it is working for both servers. Help me with this multiple logins through .bat file.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)