# Getting output in a particular format for two commands in dos



## lalitpct (Apr 26, 2011)

Suppose if i want output in cmd as [email protected] , how this can be acheived when i use below commands ,output comes in two different lines.
echo %username%&&hostname


----------



## Squashman (Apr 4, 2003)

Why are you using the double ampersands?


----------



## lalitpct (Apr 26, 2011)

Squashman said:


> Why are you using the double ampersands?


i just saw a method in in google to run multiple commands in dos , if you have better way to run it please let me know


----------



## Squashman (Apr 4, 2003)

Well on my computer HOSTNAME is the same as the environmental variable COMPUTERNAME. Why not just use COMPUTERNAME?

```
echo %username%@%computername%
```
But if you really want to make it complicated.

```
<nul set /p =%username%@&for /f "delims=" %a in ('hostname') do @echo %a
```


----------

