I must in this case give a negative answer - using blanks in a doskey name is impossible.
Doskey was created for the Command Prompt (cmd), so is rather simple in concept.
This is impossible in my opinion since :
- In a doskey command such as
doskey a b=ab, it takes "a" for an invalid option
- The doskey command does not accept quotes around the macro name.
Here are some tests I have run :
As you can see, some special characters are accepted, but just not blanks.
Even without blanks in the macro name,
doskey is an old DOS program and can only work in PowerShell with difficulty.
It conflicts with the
PSReadLine module which relies on the native console input functions. I tested this :
As you can see, you need to do two additional actions :
- Issue the command
- Add to the doskey command the parameter
When both are done, the command is executed correctly and gives the
My best advice is not to use doskey in PowerShell.
Doskey is old and PowerShell is new, and they can only be used together
I really don't think that doskey is so useful as to be irreplaceable.
Try to find another solution to your often-used commands.
For example, store the commands in in executable files such as
.bat inside a folder that you would add to the PATH.