Pass id & pw variables from bat to text file

June 4, 2009 at 08:47:37
Specs: Windows XP
I have a bat file that asks for user id and password then executes FTP reading the values in a text file. How do you pass the id and password variables to the text file?

bat file:

Echo Off
set /p userid=Enter Your Mainframe User ID :
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>
set /p password=Enter Your Mainframe Password:<nul
for /f "tokens=*" %%i in ('') do (set password=%%i)
echo %userid%
echo %password%

ftp -d -n -s:c:\downloads\test.txt mvstest

Text file:

put source destination

See More: Pass id & pw variables from bat to text file

Report •

June 4, 2009 at 13:02:09
@(echo %userid%
echo %password%
echo put source destination
echo quit)>test.txt
ftp -d -s:c:\downloads\test.txt mvstest

Report •

June 8, 2009 at 05:32:27
The code you provided is building the text file in the bat file. However, the password is displaying on the screen due to the echo and I can't have the password visible. That is why I was trying to pass the id and password to the text file as a variable, but I don't know if that can be done or not. Is there a way to hide the password using the method you provided?

Report •

June 8, 2009 at 10:53:50
I took off the -d in the ftp step and it stopped showing the password, but is there a better way of hiding the password?

Report •

Related Solutions

Ask Question