ask set /p variable on a different line

前端 未结 1 1323
感动是毒
感动是毒 2021-01-14 16:54

I\'ve seen in batch code that you can ask for user input on a separate line or continue while asking or something. For example it would look something like this;

<         


        
相关标签:
1条回答
  • 2021-01-14 17:48
    @echo off
    setlocal
    
    cls
    echo  enter your name
    echo name: 
    echo enter name above
    
    rem Move cursor to one line below screen size,
    rem you must adjust this value to fit your screen.
    for /L %%i in (1,1,34) do echo/
    
    rem Move cursor to screen home and hide timeout "Waiting..." message
    for /F %%a in ('timeout /T 1 ^> CON') do rem
    
    set /P "name=name: "
    echo/
    echo/
    echo/
    echo Name read: "%name%"
    

    Further details at this post

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