Use Echo and Another Command in the Same Line in Batch File

Use Echo and Another Command in the Same Line in Batch File

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

1

2 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 && notepad

So 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.

  1. 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

  1. Or maybe you must check the prompt command.

check for the use: prompt /?

example code: prompt x$G (the output is: x> )

  1. If you want to OUTPUT in the same line then, already explained well by user 'Sonamor' (answer #1).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.