Computing.Net > Forums > Programming > Pass id & pw variables from bat to text file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Pass id & pw variables from bat to text file

Reply to Message Icon

Name: beard9232
Date: June 4, 2009 at 08:47:37 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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
CLS
set /p userid=Enter Your Mainframe User ID :
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
set /p password=Enter Your Mainframe Password:<nul
for /f "tokens=*" %%i in ('in.com') do (set password=%%i)
del in.com
cls
echo %userid%
echo %password%

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

Text file:

%userid%
%password%
put source destination
quit



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: June 4, 2009 at 13:02:09 Pacific
Reply:

@(echo %userid%
echo %password%
echo put source destination
echo quit)>test.txt
ftp -d -s:c:\downloads\test.txt mvstest


0

Response Number 2
Name: beard9232
Date: June 8, 2009 at 05:32:27 Pacific
Reply:

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?


0

Response Number 3
Name: beard9232
Date: June 8, 2009 at 10:53:50 Pacific
Reply:

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?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Pass id & pw variables from bat to text file

printing variable to text file www.computing.net/answers/programming/printing-variable-to-text-file/14677.html

passing a value to text file www.computing.net/answers/programming/passing-a-value-to-text-file-/18831.html

HTML How do I write to text file? www.computing.net/answers/programming/html-how-do-i-write-to-text-file/9317.html