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开发者_StackOverflow社区 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 myKeystoreWhat's the correct way to do it ?
Alright I figured it out, it should be like this :
keytool -list -keystore myKeystore -storepass myPW
echo "myPW" | keytool -list -keystore myKeystore
This should work for stdin (but not stderr).
精彩评论