Doskey batch file command not working with cmd shortcut

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Helix579
Posts: 1
Joined: 24 Apr 2020 18:12

Doskey batch file command not working with cmd shortcut

#1 Post by Helix579 » 24 Apr 2020 18:18

I have the following registered doskey command 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". (read further down)

Image

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

Here are my macrofiles:

alsias.bat

@echo off

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

m7connect.bat

@echo off

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

m50connect.bat

@echo off

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

Aacini
Expert
Posts: 1885
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Doskey batch file command not working with cmd shortcut

#2 Post by Aacini » 25 Apr 2020 05:33

If you read the description of DOSKEY /? command, it says something like "Edit command lines and creates macros".

Again: it works on command lines. What a "command line" is? Is the line that you create when you type in keyboard keys using your fingers at the command prompt.

The lines placed in a Batch file are not "command lines". They are lines in a file.

In other words: DOSKEY macros does not work in Batch files.

Antonio

PS - Please use code tags to enclose your code (the fifth [</>] button above the question-entry window)

Post Reply