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.
does not inherit environment variables
is also not correct. 1) not existing a new process there is nothing to inherit 2) variables are not echoed, but they are properly initialized, you can replace theecho ^%a^% ^%b^%
with aset
command and see them, simply you can not directly retrieve their value. – Asynchronism