Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Escape the ampersand.

foo=bar ^& baz
share|improve this answer
add comment

Use $T to separate commands:

doskey foo=bar $T baz
doskey cpdel=copy $1 $2 $T del $1

from doskey /?:

$T     Command separator.  Allows multiple commands in a macro.
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.