2

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
  • 1
    If your problem is to output the > character, then you need to use echo x^>. If you also need to suppress the new-line, then use <nul (set/p a=x^>). See this reference for more details.
    – AFH
    Commented Aug 30, 2018 at 13:36

2 Answers 2

2

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
  • its very helpful,but instead of jumping to the next line i want it to be x> Commented Aug 30, 2018 at 13:34
  • echo off && set /p "a=x>" it worked thx Commented Aug 30, 2018 at 13:41
  • 1
    The && (double ampersand) only executes the command on its right if the command on its left returns with a zero errorlevel. The command continuation character in Windows cmd is & (a single ampersand.) The converse of && is || (double pipe), which executes the command on its right if the command on its left returns with a non-zero errorlevel. Commented Aug 30, 2018 at 16:25
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .