質問

I have some problem about run windows cmd ,when I run my code on GEL or some java tool,it works,but it run error that windows can't find "pscp".However,I export execute jar from eclipse and java -jar ..It works!! I set pscp path first, so i can type pscp commend on cmd.

String file="test5.pdf";

String Ip="140.118.175.196";
String commend="cmd.exe /c start pscp.exe d://"+file+" admin@"+Ip+":/home/admin/test";

Process ee = Runtime.getRuntime().exec(commend);

What happen? Thanks.

役に立ちましたか?

解決

pscp.exe is not in your path. You need to add it to your path or put in the command string the complete path to the pscp.exe executable.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top