views:

37

answers:

2

I'm writing a Java program to simulate a command line feeder, it runs DOS commands like this : "Java -version" fine, but for something more complex, such as asking for a second parameter, it won't work, I roughly remember in Unix there is something like : "abc | 123" or maybe it's "abc < 123", I wonder in Windows command prompt is there anything like that ? So for the following example :

> keytool -list -keystore myKeystore > Enter keystore password: myPW I can feed it with this : "keytool -list -keystore myKeystore | myPW" or this : "keytool -list -keystore myKeystore

What's the correct way to do it ?

A: 
echo "myPW" | keytool -list -keystore myKeystore

This should work for stdin (but not stderr).

Francis
+1  A: 

Alright I figured it out, it should be like this :

keytool -list -keystore myKeystore -storepass myPW
Frank