Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nesting doskey macros

Tags:

cmd

doskey

I'd just like to know if there is a way to call one doskey macro from another. I tried the following, but it doesn't work:

>doskey cleanpix=%PATH%\cleanpix.bat
>doskey cp=cleanpix

What am I doing wrong?

If there's no way to do what I'm trying to do, is there another way to define cp to the same commands as the defintion of cleanpix without typing all that shit out all over again? Besides CTRL+C, CTRL+V of course.

like image 339
user3338441 Avatar asked Mar 05 '14 20:03

user3338441


People also ask

How do I save a macro in doskey?

Once you create your collection of macros, save them to a file. To do so, enter DOSKEY /macros > filename. You can load them into memory by entering DOSKEY /macrofile=filename.

What does doskey do?

DOSKEY is a command for DOS, IBM OS/2, Microsoft Windows, and ReactOS that adds command history, macro functionality, and improved editing features to the command-line interpreters COMMAND.COM and cmd.exe .


1 Answers

I don't believe DOSKEY macros can call one another directly. You're probably better off using a quicky batch file like this. Create a file called (say) cp.cmd and put it somewhere in your path. Its contents should be:

call %PATHTOCLEANPIX%\cleanpix.bat %*

One other note about your question - I assume that %PATH% was an example for the question, and not the literal value you're trying to use. PATH is a built-in environment variable that holds a list of directories where cmd should look for executables.

like image 152
Mark Avatar answered Oct 06 '22 00:10

Mark