Using doskey to spawn multiple instances of explorer

346 Views Asked by At

So I'm trying to create a Doskey alias to spawn 3 instances of windows explorer, opening 3 different directories.

I have my cmd.exe shortcut set up to read from file.cmd which has the following inside:

    @echo on
    DOSKEY ls=dir
    DOSKEY b=cmd.exe /K explorer "\\eservername\firstdirectory"
    DOSKEY c=cmd.exe /K explorer "\\eservername\seconddirectory"
    DOSKEY d=cmd.exe /K explorer "\\eservername\thirddirectory"

When opening my cmd.exe shortcut, I can type in "b" or "c" or "d" and hit enter, and it will open each directory just fine. Great!

So now I'll just do this:

    DOSKEY run=a&b&c

But... I can't run another command that references those DOSKEY aliases because that's not allowed.
I also tried chaining them together under one DOSKEY alias like so:

    DOSKEY runme="cmd.exe /K explorer "\\eservername\firstdirectory" && cmd.exe /K explorer "\\eservername\seconddirectory" && cmd.exe /K explorer "\\eservername\thirddirectory" together with && and it did not work.

This only opens the last window!

How do I get it to spawn three separate instances of three different directories?

1

There are 1 best solutions below

0
On

I also wished I could chain DOSKEY aliases together into a new one.

But what does should work is the following, using ^&:

DOSKEY run=        cmd.exe /K explorer "\\eservername\firstdirectory" 
                ^& cmd.exe /K explorer "\\eservername\seconddirectory" 
                ^& cmd.exe /K explorer "\\eservername\thirddirectory"

Formatted to get a better view, a oneliner might be hard to read.

That works for me in this alias:

DOSKEY go=cd C:\svn\my\actual\project\im\working\on ^& mvn gwt:debug

Hope that helps :)