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

Can't use aliases + && #224

Closed
tleb opened this issue Jul 28, 2014 · 4 comments
Closed

Can't use aliases + && #224

tleb opened this issue Jul 28, 2014 · 4 comments

Comments

@tleb
Copy link

tleb commented Jul 28, 2014

Can't use this, for example: desktop && ls where desktop is alias desktop=c: $T cd C:\Users\USER\Desktop\.

@sc0tt
Copy link
Contributor

sc0tt commented Jul 28, 2014

This isn't a global fix, but should work for most things, but if you put $* at the end of the command it seems like it works.

desktop=c: $T cd $*

It would be nice to be able to use aliases in chains, but this should work until then.

@glucas
Copy link
Contributor

glucas commented Jul 28, 2014

This is a limitation of doskey, which provides the cmd.exe support for aliases (macros). You actually can't use a macro after && at all.

For example:

λ alias np=notepad.exe
λ cd C:\Users && np
'np' is not recognized as an internal or external command, operable program or batch file.

whereas this works fine without the macro:

λ cd C:\Users && notepad.exe

Macros only work as the first part of a command. See http://technet.microsoft.com/en-us/library/bb490894.aspx, specifically:
"To run a macro, type the macro name starting at the first position on the command line... You [also] cannot run a doskey macro from a batch program."

@rmorrin
Copy link
Contributor

rmorrin commented Sep 5, 2014

Does this mean it is also impossible to redirect the output from a doskey to another command?

Suppose I want to copy the output to the clipboard:

λ doskey text=echo copy this text to the clipboard
λ text | clip
copy this text to the clipboard

The output from the doskey is still displayed, and not redirected to clip.

@luisrudge
Copy link

so, here's my snippet:
mu=cd c:\git\myupdates $T atom . $T cd src $*

I want to:

  • open the project's root folder
  • call atom to open this folder
  • cd into .\src directory

Is that possible?

@tleb tleb closed this as completed Jan 17, 2016
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

5 participants