Automating -createPasswordFile in Windows
I'm currently trying to automate the set up of JBEs on Windows environments. I'm at the point of creating the password file using:
jbe.bat -createPasswordFile
Which launches a Java process requesting user input. I would like to know if it's possible to redirect input to the process which is launched, auto-completing the request for a password. For reference purposes our solution in Linux is:
echo "${jazz_password}" | ./jbe.sh createPasswordFile
|
Accepted answer
Your problem is related more to Windows batch file restrictions than the command itself. By running the JBE launcher jar directly I was able to get this to work:
C:\tmp\IBM\jbe>set JAVA_HOME=C:\IBM\Rational\RTC\RTC-Eclipse\4.0.6\jazz\client\eclipse\jdk C:\tmp\IBM\jbe>echo secret | %JAVA_HOME%\jre\bin\java -jar C:\IBM\Rational\RTC\toolkits\4.0.6\buildtoolkit\jazz\buildsystem\buildengine\eclipse\plugins\org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar -createPasswordFile tom *** Warning: password will be printed to the screen. password: Password stored in file: "C:\tmp\IBM\jbe\tom" *** Warning: The password is encrypted to prevent casual observation, but a determined attacker may discover the password. The password file should be protected with operating system file permissions.This yielded the following password file (* substituted for ? and ! due to editor restrictions): C:\tmp\IBM\jbe>type tom <*xml version="1.0" encoding="UTF-8"*> <*DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>4.0</comment> <entry key="password">TW6nCXFrd+4=</entry> </properties> Michael Shaffer selected this answer as the correct answer
Comments FYI you can further refine this to prevent any output to the console by redirecting the output to the nul device:
C:\tmp\IBM\jbe>echo secret | %JAVA_HOME%\java -jar C:\IBM\Rational\RTC\toolkits\4.0.6\buildtoolkit\jazz\buildsystem\buildengine\eclipse\plugins\org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar -createPasswordFile tom > nul 2>&1 1
Michael Shaffer
commented Nov 24 '14, 4:30 a.m.
Alan, thanks for the quick and concise response, I really appreciate it! |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.