简体   繁体   中英

Run alias command from command prompt in new command prompt

So I've set up a file with some aliases for commands that I commonly use. I added it to the registry like in this answer .

I want to use this alias like so:

>cmd /k newalias 
'newalias' is not recognized as an internal or external command,
 operable program or batch file.

So this alias cannot be used. If I type >cmd /k newalias again, now it works, so the problem seems to be that the command is being run before the doskey commands in the alias file are executed.

Is there any way to wait until after these aliases are created before running the command?

strange behaviour, but if you use doskey after you import your macro that is working :

cmd /K "doskey /macrofile=c:\temp\macros.txt  & doskey /macros >null & newalias"

edit the above commant doesnt work, newalias has to be written manually in the console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM