Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在打印出在 Windows 中被覆盖的一行(如状态栏)cmd.exe。我正在使用System.out.print("\r" + fileName + " " + progress).
cmd.exe
System.out.print("\r" + fileName + " " + progress)
问题是如果fileName是 UTF-8,Windows 不会正确返回到行首并覆盖最后一条消息。
fileName
小问题,但我想看看是否有解决方案。谢谢!
您可能想尝试\r\n:
\r\n
System.out.print("\r" + System.getProperty("line.separator") + "bla bla");