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

campbjj

Okay, I tried something, and it is giving me some good results, but I'm not quite where I want to be yet. I modified my calling script like so:
@echo off
for /f %%i in ('realdate.com /d') do (set DT=%%i)
md c:\LOGFILES\%DT%
set /p input=Type password:
"C:\Program Files\WinSCP\WinSCP.exe" /console /script="C:\auto_ftp.txt"

And then, in C:\auto_ftp.txt I changed all the logins to use the following
user:%input%@exampleserver1

However, the issue that I have is that this password is being typed in clear text when the user enters it. Is there another way of doing this, or of a way to have the window mask the typing?

Thanks.
campbjj

Script that prompts for password and then uses as variable

Following the great examples here, I have created a DOS batch file that can connect to one server, download files, disconnect from that server, reconnect to another server, downloads files, etc... In total I do the same thing to about 6 servers. This scripting is a huge advantage to me and makes me a little more productive. The initial call is scripted like this (test_call.bat):
for /f %%i in ('realdate.com /d') do (set DT=%%i) 
md c:\LOGFILES\%DT%
"C:\Program Files\WinSCP\WinSCP.exe" /console /script="C:\auto_ftp.txt"


For each of the servers that I am connecting to and downloading the files for, I use the same username and password. So, yes, in the solution as it stands now I must type in the password each time the script changes servers. See something close to C:\auto_ftp.txt below.
open user@exampleserver1
get /logfiles/logfile.log c:/logfiles/%DT%/exampleserver1.logfile.log
close
open user@exampleserver2
get /logfiles/logfile.log c:/logfiles/%DT%/exampleserver2.logfile.log
close
open user@exampleserver3
get /logfiles/logfile.log c:/logfiles/%DT%/exampleserver3.logfile.log
close

And so forth. For security reasons, I do not want to put the password into the C:\auto_ftp.txt file. Is there a way to have test_call.bat prompt me for the password, store that as a variable, and then C:\auto_ftp.txt can use the variable for the password?

Thanks for your time.