Jsch Shell チャネルを使用して Windows XP でコマンドを実行しようとしていますが、何らかの理由で System.out ストリームに奇妙なシンボルが表示され、コマンドを実行できません。接続に使用するコードは次のとおりです。
this.session = jsch.getSession(this.login, this.host);
Properties properties = new Properties();
properties.put("StrictHostKeyChecking", "no");
session.setPassword(this.password);
session.setConfig(properties);
session.connect(30000);
channel =(ChannelShell) session.openChannel("shell");
PipedInputStream pip = new PipedInputStream(40);
channel.setInputStream(pip);
channel.setOutputStream(System.out);
PipedOutputStream pop = new PipedOutputStream(pip);
print = new PrintStream(pop);
channel.connect();
次に、次のメッセージが表示されます。
[1;1HMicrosoft Windows XP [Versi�n 5.1.2600][2;1H(C) Copyright 1985-2001 Microsoft Corp.[4;1HC:\Documents and Settings\diego\Escritorio>[4;44H
そして、cd C:\MyFolder\ を呼び出そうとすると、別のコマンド (すべて ssh クライアントからテストされ、機能します) を呼び出すと、さらに奇妙なシンボルが生成され、コマンドの結果が得られません。何が問題なのですか? 以下は、私が送信したコマンドと結果です。
exec.print.println("cd C:\\MyFolder\\");
exec.print.println("some other command");
結果:
[1;1HMicrosoft Windows XP [Versi�n 5.1.2600][2;1H(C) Copyright 1985-2001 Microsoft Corp.[4;1HC:\Documents and Settings\diego\Escritorio>[4;44H[4;1HC:\Documents and Settings\diego\Escritorio>c[4;58H[4;1HC:\Documents and Settings\diego\Escritorio>cd C:\MyFolder\[4;58H[4;46H[4;58H[4;47H[4;58H[4;48H[4;58H[4;49H[4;58H[4;50H[4;58H[4;51H[4;58H[4;52H[4;58H[4;53H[4;58H[4;54H[4;58H[4;55H[4;58H[4;56H[4;58H[4;57H[4;58H
Windows XP で FreeSShd を使用しており、プログラムは Ubuntu で実行されます。コンソールで ssh を使用し、Windows XP で動作します。Java プログラムに実装しようとしています。助けてくれてありがとう。