From bat - open cmd, load doskey macros, and execute a macro

1.4k Views Asked by At

Is it possible to use cmd /k "doskey /macrofile=C:\myMacros.cmd && macroCommand" from a bat file.

I have tried that as well as start cmd.exe /k "doskey /macrofile=C:\myMacros.cmd && macroCommand". How can I make this work?

I googled a little and found something about piping, but I don't even know what this is, and even after researching that a little, I don't see how this would help run a macro after starting cmd and loading macros.

1

There are 1 best solutions below

0
On

assuming macros.cmd reside in %userprofile% and in the form of macro list

running :

start cmd /k "(doskey /macrofile=%userprofile%\macros.cmd)"

will get you what you wanted e.g. open a new cmd window loaded with the predefined macros