How do I clear ONLY ONE LINE of cmd?

后端 未结 1 1329
灰色年华
灰色年华 2020-12-20 10:16

So, I have added some stuff in cmd. I want there to be a progress bar using text, so that it is like [......... ], but when I type in CLS to clear the line and ECHO to rem

相关标签:
1条回答
  • 2020-12-20 10:55

    Use something like this:

    @echo off
    setlocal enableDelayedExpansion
    
    :: Define CR to contain a carriage return (0x0D)
    for /f %%A in ('copy /Z "%~dpf0" nul') do set "CR=%%A"
    
    <nul set/p"=[*............]!CR!"
    pause >nul
    <nul set/p"=[**...........]!CR!"
    pause >nul
    <nul set/p"=[***..........]!CR!"
    pause >nul
    

    From here

    0 讨论(0)
提交回复
热议问题