Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to execute this command on windows, but It seems Java exec is not working with the redirect. How can I solve this problem?

c:/coolroid/gicater/mysqldump.exe -h127.0.0.1 -uroot -pagile -P3308 coolroid > C:/jukebackup/coolroid_1498793488965.bak
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
208 views
Welcome To Ask or Share your Answers For Others

1 Answer

The piping isn't working because normally the outputstream of the application you are running would be available through Process.getInputStream().

The way to fix this is to run "cmd" first, then send in your statement via the process's OutputStream


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...