Launch Windows Explorer and goto the current working directory in shell

I like working in the command prompt – it’s fast and you can do batch processing, etc, but sometimes, I need a GUI (Windows explorer) to explore files in the current directory. I know I can type “explorer.exe” on the command line to launch Windows explorer, but can it automatically go to the directory I’m working in? The answer is yes, although hardly ever advertised:

Now, we need to find a way to find out the current working directory. On the command prompt, it’s stored in the environment variable %CD%, so combine the two:

explorer /root,%CD%

and it works beautifully.

Put this in a .bat file and put it on your path, you can launch Windows explorer anywhere and have it go directly to the folder you’re in on the command line!

Advertisements
Leave a comment

1 Comment

  1. Alon

     /  June 9, 2011

    I use this for the same purpose:
    start .
    That is, “start” followed by a dot. The dot represents the current directory.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: