Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doskey macros not working from Insider build 15031 #438

Open
chris-morgan opened this issue Feb 27, 2017 · 16 comments
Open

doskey macros not working from Insider build 15031 #438

chris-morgan opened this issue Feb 27, 2017 · 16 comments

Comments

@chris-morgan
Copy link

From build 15002 onwards Clink stopped working; now it’s working again, except that doskey macros aren’t working (though they are outside Clink):

C:\Users\me>doskey /macros
g=git $*

C:\Users\me>g
'g' is not recognized as an internal or external command,
operable program or batch file.

There doesn’t appear to be anything useful in clink.log.

@mattdkerr
Copy link

confirmed still not working in build 15063

@chris-morgan
Copy link
Author

More importantly, 15063 is the Creators Update build which is being released to everyone on the 11th of this month, so starting in a week’s time everyone’s going to be upgrading to a build where clink breaks doskey macros.

Fixing this is now very urgent.

@anagnoad
Copy link

anagnoad commented Apr 6, 2017

Sadly, Creators Update is already released through Windows 10 Upgrade assistant. :/ Is there any known workaround?

@chris-morgan
Copy link
Author

chris-morgan commented Apr 6, 2017

The workaround I settled on was this:

  1. Create %USERPROFILE%\bin and put it on the PATH. Alternatively work with a directory already in the PATH. It’s entirely up to you.
  2. For each macro of the form foo=bar $*, create a file foo.cmd in the directory from the previous step, containing @bar %*. That is, change the $ to % and prepend an @.

It’s that easy!

Well, normally, anyway. If you have a macro with the same name as a binary, such as ls=ls --color=auto, you’ll need to make sure that your ls.cmd uses the full path to ls.exe, quoted if necessary (e.g. "C:\Program Files\Git\usr\bin\ls.exe"), and that it’s earlier in the PATH than ls.exe is. (This tends to mean that it needs to be in the system PATH variable rather than the user PATH variable. And then you can’t use %USERPROFILE%, you’ll have to expand it.)

@anagnoad
Copy link

anagnoad commented Apr 6, 2017

That actually is easy, thank you for sharing. :)
I used to do it like that in the past, as I wanted to have custom shortcuts for Run (Win+R). But using a tool like Cmder introduced me to the beauty of having this managed just with a simple "alias foo=bar" command, so it would be hard to go back after that.

I have tried to start using bash or equivalents which are unaffected by Creator's Update. But then again, in the bash world (the WSL bash at least) you lose seemless Windows command line interop. :/

I hope the issue will be fixed soon.

@MonwF
Copy link

MonwF commented Apr 7, 2017

just another workaround from cmder issues cmderdev/cmder#1325

thanks to @phytemit

@anagnoad
Copy link

anagnoad commented Apr 8, 2017

Is the issue fixed with #433? :)

@mattdkerr
Copy link

No, it is not.

@bannus
Copy link

bannus commented Apr 17, 2017

For anyone that has a bunch of aliases you load from a file like I do, here's a quick powershell script that you could adapt to use @chris-morgan's workaround:

$aliases = get-content .\aliases.doskey
foreach ($alias in $aliases) {
    if (!$alias -or $alias[0] -eq '#') {
        continue;
    }
    $tokens = $alias.Split('=');
    $filename = "$($tokens[0]).cmd"
    $command = "@$($tokens[1].Replace("$", "%"))"
    # change TODO to directory in PATH
    # $command | Add-Content "TODO/$filename"
    write-host $filename
}

@bitcrazed
Copy link

bitcrazed commented Oct 23, 2017

We're looking into this: Looks like it's caused by us fixing behavior to operate correctly, but this breaks Clink's logic.

Anyone know how to reach @mridgers directly?

@mattdkerr
Copy link

There's also a PR to fix Clink but the owners haven't merged it #464

@Stanzilla
Copy link

@bitcrazed Twitter (https://twitter.com/choddlander) used to work but hasn't for a while. We made a fork for the @cmderdev project at https://github.com/Stanzilla/clink and merged a few patches. I haven't cut a new Cmder release in a while but the CI builds work. Might do a release when I get home on the weekend though. Are you getting many reports because of us? The alpha/CI builds should work well for everyone else in here though.

@adudar5
Copy link

adudar5 commented Dec 18, 2017

Not sure what the consequences of using "legacy console" are, but this fixed my alias problem.
Found this on another thread #1257:

image

@Stanzilla
Copy link

It disables every new feature.

@adiviness
Copy link

Is this still happening on the more recent insider builds? I'm unable to repro it.

@chris-morgan
Copy link
Author

Still happening on 17063:

With Clink:

C:\Users\me>doskey foo=echo It works!

C:\Users\me>foo
'foo' is not recognized as an internal or external command,
operable program or batch file.

Without Clink:

C:\Users\me>doskey foo=echo It works!

C:\Users\me>foo
It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants