Discussion:
Doskey alias command from a cmd shortcut not working
(too old to reply)
r***@gmail.com
2020-04-24 23:54:11 UTC
Permalink
I have the following in the Target of a cmd shortcut on my desktop: "C:\Windows\System32\cmd.exe /k m50"

But the cmd windows shows the following error: "'m50' is not recognized as an internal or external command".

The doskey macrofile has been registered in the registry. How can I make this work? Thanks.

Here are my macrofiles:

alsias.cmd

@echo off

doskey m7=C:\Bin\m7connect.bat
doskey m50=C:\Bin\m50connect.bat

m7connect.cmd

@echo off

adb disconnect
adb connect 192.168.1.7
timeout /t 1 /nobreak
scrcpy

m50connect.cmd

@echo off

adb disconnect
adb connect 192.168.1.8
timeout /t 1 /nobreak
scrcpy
JJ
2020-04-25 12:30:33 UTC
Permalink
Post by r***@gmail.com
"C:\Windows\System32\cmd.exe /k m50"
But the cmd windows shows the following error: "'m50' is not recognized
as an internal or external command".
The doskey macrofile has been registered in the registry. How can I make this work? Thanks.
DOSKEY won't work like you expected, because it doesn't work like that.

Every console window has it's own alias, and other console input
configurations. DOSKEY simply changes & manages those configurations.

So, as long as that console window is still open, the configured macros will
work - assuming that whatever console program is running in that console
window, does not use their own input handler (which basically makes the
alias ineffective).

If the console window is closed, then the macros are gone. Also, macros are
not inherited to child console windows.

Loading...