Hi,
On Windows XP SP2 using DB2 WSE v8.2 FP9 I have written batch file to get 'create table' syntax by executing db2look command. The problem is how to hide password during user entering in it on screen?
Question: how to hide password?
One solution is at
Google groups and it is working well if Windows CMD is used, but using DB2CMD command it just mess the things up.
Code:
@echo off
rem ================ 'Get password not displayed on screen' ==============
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
set /p password=Enter database password:<nul
for /f "tokens=*" %%i in ('in.com') do (
set password=%%i
rem Display 'i' and 'password' variables
echo %%i
echo %password%
)
del in.com
rem ================ End of 'Get password not displayed on screen' =======
rem Execute db2look command
db2look -d sample -e -nofed -z tabschema -t tab1 -i db2admin -w %password%
Note: in.com is assembler program which hides password.
Executing above batch file it produces the following output:
Code:
Enter database password:‰>!–»—€>–abc
ECHO is off.
The filename, directory name, or volume label syntax is incorrect.
But executing the sam batch file again it works fine, without any problem.
Why are there "‰>!–»—€>–" charachter executing when batch file is executed first time and no special characters on second time?
Is there any other way to hide password?
Thanks,
Grofaty