3

I am trying to make a directory and immediately change into it with a DOSKEY. I thought this would work but it gives me the error The filename, directory name, or volume label syntax is incorrect.

DOSKEY md=mkdir $* && cd $*

Does anyone know why this is wrong and how to fix it?

SirParselot
  • 2,640
  • 2
  • 20
  • 31
  • Why do you need DOSKEY to do this. `mkdir yyy & cd yyy` The $* represents -all- command line variables. Are you sure that is what you want? Quoting is needed if the new directory can have a space character. `MKDIR "%*" & CD "%*"` – lit Mar 21 '16 at 18:44
  • @Liturgist I'm trying to create an alias which is why I am using doskey and the reason I had `$*` was because I was getting my information from a bad source. Good call on the quotes but that command doesn't work. using `"$*"` works in place of `"%*"` though. % isn't recognized by doskey – SirParselot Mar 21 '16 at 19:05

2 Answers2

0

I ended up finding the answer here

DOSKEY md=mkdir "$1"$tcd "$1"

I was trying to use && instead of $t

SirParselot
  • 2,640
  • 2
  • 20
  • 31
0

Does this work for you?

C:>doskey aaa=MKDIR "$*"$tCD "$*"

C:>doskey /macros
aaa=MKDIR "$*"$tCD "$*"

C:>aaa arf

C:>
13:33:59.15  C:\Users\pwatson\x\arf
C:>
lit
  • 14,456
  • 10
  • 65
  • 119