Nesting doskey macros

不想你离开。 提交于 2019-12-12 10:40:03

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/22208993/nesting-doskey-macros

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!