Windows – Doskey for compound command

command linewindows

Doskey works in modern versions of Windows for setting aliases for single commands, e.g. doskey foo=bar.

There's a slight problem trying to use it for compound commands like doskey foo=bar & baz since this gets interpreted as (doskey foo=bar) & baz. The obvious fix would be to add explicit parentheses, doskey foo=(bar & baz) but for some reason this doesn't work, and doskey foo="bar & baz" doesn't work either.

Is there any way of doing this?

Best Answer

Escape the ampersand.

foo=bar ^& baz