The doskey command separator ($T) generates a blank line when the command produces no output.
C:\> set "a="
C:\> set "b="
C:\> doskey test=set "a=foo" $T set "b=bar" $T echo ^%a^% ^%b^%
C:\> test
C:\>
C:\> foo bar
Note the blank line after issuing test, which affects readability.
There is a well-known ^? alternative to $T, which does not add blanks, but the new command does not inherits environment variables.
C:\> set "a="
C:\> set "b="
C:\> doskey test=set "a=foo" ^& set "b=bar" ^& echo ^%a^% ^%b^%
C:\> test
%a% %b%
There are no blanks here, anyway set is ineffective after starting a new command.
How can I remove the blank lines?
Update: Removed "creates a separate process" line as it was wrong.