Passing doskey alias file to commandline not working #17626

Closed
opened 2026-01-31 05:48:06 +00:00 by claunia · 4 comments
Owner

Originally created by @jathek on GitHub (Jun 4, 2022).

Windows Terminal version

1.13.10733.0

Windows build number

10.0.19044.1645

Other Software

No response

Steps to reproduce

Trying to use an alias.cmd file as mentioned in this issue.

Profile in settings.json:

            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "graceful",
                "commandline": "cmd.exe /K \"C:\\Users\\Jason\\alias.cmd\"",
                "elevate": false,
                "guid": "{7a1c5dd6-779d-4b81-9599-8cbe559fc419}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
                "name": "Command Prompt",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%"
            }

alias.cmd:

@echo off
doskey s=ssh $*

Expected Behavior

No response

Actual Behavior

Commands are not available when I open Terminal, but they become available after I manually run alias.cmd from the Terminal window.

Originally created by @jathek on GitHub (Jun 4, 2022). ### Windows Terminal version 1.13.10733.0 ### Windows build number 10.0.19044.1645 ### Other Software _No response_ ### Steps to reproduce Trying to use an alias.cmd file as mentioned in [this issue](https://github.com/microsoft/terminal/issues/4019#issuecomment-567427024). Profile in settings.json: ```json { "altGrAliasing": true, "antialiasingMode": "grayscale", "closeOnExit": "graceful", "commandline": "cmd.exe /K \"C:\\Users\\Jason\\alias.cmd\"", "elevate": false, "guid": "{7a1c5dd6-779d-4b81-9599-8cbe559fc419}", "hidden": false, "historySize": 9001, "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png", "name": "Command Prompt", "snapOnInput": true, "startingDirectory": "%USERPROFILE%" } ``` alias.cmd: ```batch @echo off doskey s=ssh $* ``` ### Expected Behavior _No response_ ### Actual Behavior Commands are not available when I open Terminal, but they become available after I manually run alias.cmd from the Terminal window.
claunia added the Needs-TriageIssue-BugNeeds-Tag-FixProduct-Terminal labels 2026-01-31 05:48:06 +00:00
Author
Owner

@vefatica commented on GitHub (Jun 11, 2022):

It's only a workaround, but I have my DOSKEY macros defined in CMD's "autorun" file, specified here:

regdir /v /d "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor"
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor
  Autorun : REG_SZ : d:\uty\cmdstart.bat

It works.

@vefatica commented on GitHub (Jun 11, 2022): It's only a workaround, but I have my DOSKEY macros defined in CMD's "autorun" file, specified here: ``` regdir /v /d "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor" HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor Autorun : REG_SZ : d:\uty\cmdstart.bat ``` It works.
Author
Owner

@vefatica commented on GitHub (Jun 11, 2022):

I misspoke. My "autorun" file looks like this.

v:\> type u:\cmdstart.bat
@echo off
doskey /macrofile=d:\uty\doskey.txt
chcp 1252 > NUL
@vefatica commented on GitHub (Jun 11, 2022): I misspoke. My "autorun" file looks like this. ``` v:\> type u:\cmdstart.bat @echo off doskey /macrofile=d:\uty\doskey.txt chcp 1252 > NUL ```
Author
Owner

@vefatica commented on GitHub (Jun 11, 2022):

FWIW, this works here, that is, the CMD file is executed.

"commandline": "%SystemRoot%\\System32\\cmd.exe /K \"v:\\foo.cmd\""

@vefatica commented on GitHub (Jun 11, 2022): FWIW, this works here, that is, the CMD file is executed. `"commandline": "%SystemRoot%\\System32\\cmd.exe /K \"v:\\foo.cmd\""`
Author
Owner

@jathek commented on GitHub (Aug 5, 2022):

FWIW, this works here, that is, the CMD file is executed.

"commandline": "%SystemRoot%\\System32\\cmd.exe /K \"v:\\foo.cmd\""

doesn't work for me, unfortunately. I've tried adding the %SystemRoot%\\System32\\ portion and also using / instead of \\. No joy 🙁

EDIT: finally got it working after looking more closely at the other thread. GUID was off. Works correctly when it is 0caa0dad-35be-5f56-a8ff-afceeeaa6101. I guess this means it would only work for one profile though, as the guid can't be repeated?

@jathek commented on GitHub (Aug 5, 2022): > FWIW, this works here, that is, the CMD file is executed. > > `"commandline": "%SystemRoot%\\System32\\cmd.exe /K \"v:\\foo.cmd\""` doesn't work for me, unfortunately. I've tried adding the `%SystemRoot%\\System32\\` portion and also using `/` instead of `\\`. No joy 🙁 EDIT: finally got it working after looking more closely at the other thread. GUID was off. Works correctly when it is `0caa0dad-35be-5f56-a8ff-afceeeaa6101`. I guess this means it would only work for one profile though, as the guid can't be repeated?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17626