Reputation: 3
Not beneath, but next to "set /p".
My code is
set /p "input=Input: " && echo Test
What I want the output to be is
Input: [input text here] Test
How do I do this?
Upvotes: 0
Views: 200
Reputation: 67256
This works in all Windows versions excepting Windows 10:
@echo off
setlocal EnableDelayedExpansion
rem Get BS, CR and TAB characters
for /F %%a in ('echo prompt $H ^| cmd') do set "BS=%%a"
for /F %%a in ('copy /Z "%~F0" NUL') do set "CR=%%a"
set "TAB="
for /F "skip=4 delims=pR tokens=2" %%a in ('reg query hkcu\environment /v temp' ) do set "TAB=%%a"
for /F "tokens=2 delims=0" %%a in ('shutdown /? ^| findstr /BC:E') do if not defined TAB set "TAB=%%a"
set /p "input=Input: "
echo !TAB!!BS!!BS!!CR!Input: !input! Test
In order for Windows 10 to work you need to enable Legacy console mode.
Further details at Move cursor to any position using just ECHO command
Upvotes: 1