use echo and another command in the same line in batch file
Andrew Mclaughlin
For for this code
echo x set /p "a=>"result will be
x set /p "a=>"The result i want is
x>Please help,thanks
12 Answers
You can use the && to run two command at the same time.
So lets say you want to echo something sent it to clipboard and open notepad, you will write:
echo test | clip && notepadSo yours will be
echo x && set /p "a=>" 3 This question is not clear at all because you don't explain what you want to do.
- If you just want to use two (or more) commands in the same line this is the answer:*
Just use & character between commands.
(If you want to wait for the previous command to finish before run the next command, use && instead of &)
example code: @echo off & echo test & pause
- Or maybe you must check the
promptcommand.
check for the use: prompt /?
example code: prompt x$G (the output is: x> )
- If you want to OUTPUT in the same line then, already explained well by user 'Sonamor' (answer #1).