I write a tool with java to run a command at the remote machine. I use Java JSch lib to connect remote Windows10 by OpenSSH. When I send the command to Windows10, I got the result with some messy code. Like this
[?25h[?25labc@DESKTOP-ABCD C:\Users\abc>[?25h[?25ldir
[?25h[?25l Volume in drive C is Windows[18X[18C
Volume Serial Number is 667E-DFE0[13X[13C
[47X[47C
Directory of C:\Users\abc[20X[20C
[47X[47C
2020/11/25 14:11 <DIR> .[10X[10C
2020/11/25 14:11 <DIR> ..[9X[9C
2017/03/19 06:03 <DIR> Desktop
2020/11/25 14:11 <DIR> Documents
2017/03/19 06:03 <DIR> Downloads
2017/03/19 06:03 <DIR> Favorites
2017/03/19 06:03 <DIR> Links
2017/03/19 06:03 <DIR> Music
2020/01/26 15:34 <DIR> OneDrive
2017/03/19 06:03 <DIR> Pictures
2017/08/25 14:53 <DIR> Roaming
2017/03/19 06:03 <DIR> Saved Games
2017/03/19 06:03 <DIR> Videos
]0;c:\windows\system32\cmd.exe - dir[?25h[?25l
0 File(s) 0 bytes[35X[35C
[?25h[?25l
13 Dir(s) 341,689,794,560 bytes free[29X[29C
[?25h[?25l
[80X[80C
]0;c:\windows\system32\cmd.exe[?25h[?25l
abc@DESKTOP-ABCD C:\Users\abc>[45X[45C[24;36H[?25h
There isn't an Active Code Page error. I set the Active Code Page:65001.(UTF-8) I am very confused. What are the garbled characters at the beginning and end of certain lines? How can I get rid of them?