A Simple File Explorer Magic Trick

Description

Earlier this month, Steve Smith show off a Windows/File Explorer trick that's been around since at least Windows 7, that I now show it people to blow their minds...

Open Command or Powershell Window From Explorer

"Command line tools are becoming increasingly popular, so this tip may save you some time. On Windows, there are several ways to open up a command window. My typical method is to just hit the Start key and type ‘cmd’ and then enter. This will open a window in my user folder, which is exactly where I want to be precisely 0% of the time. From there, it’s usually just a few dozen command to change folders and drives to get to where I actually need to be.

Fortunately, there’s a (much) easier way. Most of the time, I either already have a Windows Explorer/File Explorer window open for the folder I’m working with, or I can quickly get one (my go-to tools Visual Studio and SourceTree both have quick menu options to open folder in explorer). From there, it’s simple to get either a command window or a powershell window (and probably bash, but I haven’t gone there, yet). Just click in the whitespace of the path as shown below, and type ‘cmd’ (or ‘powershell’). You’ll see a new instance of the appropriate window created, and lo and behold, it in the path from which you launched it!

explorer-shortcut"

... [Click through to read the entire post]

Well a friend of mine, Gordon Beeming, liked this trick, but couldn't really use it. For his needs, he needed to open these prompts as Admin.

So being the dev that he is, he knocked out a quick utility to make it happen (and shared the it and the code with us ;)

Opening apps from the directory you in as Administrator

...

Now although there is no rocket science behind this [GD: No rocket science, just magic! ;] I never thought to ever try it, now that I have tried it I can't use it

The Problem is…

You see the problem is ever time I need a CMD or PowerShell window it generally needs to be running in admin mode (any one who knows how let me know ).

The Resolution is…

Now being a week since seeing the post I really feel that I should be using this gem so decided to write code to make it possible for me. I won't go into too much detail because the code is on GitHub (http://go.beeming.net/2hocTo8). Basically all you do is

1. Copy the admin.exe from the compiled folder on GitHub (or pull down the code and compile yourself) into your windows folder, which is location in C:\Windows by default.

2. Click in the address bar in windows explorer

 

3. Type any command [GD: type "Admin" and then any command]

image

4. Press enter and see it launch that app as Administrator with the working directory set correctly

... [Click through to read the post]



The Discussion

  • User profile image
    Austin

    You can also open a command prompt with the folder path by holding down Shift and right-clicking in the folder.

  • User profile image
    rosdi

    Nice... I know I can copy/paste from/to file explorer path but didn't know I can execute commands too...

    Thanks for sharing...

  • User profile image
    rosdi

    I just found out I could also use this keyboard shortcut, which can be execute with one hand:  [Alt] [F+S+A]

    Refer to this SO answer: http://stackoverflow.com/a/41119534/193634

  • User profile image
    Steve

    Using the file menu will also allow you to start cmd/powershell, and also as admin

  • User profile image
    James Curran

    You can also go the other way --- open Explorer focus on the current directory from a command prompt, by entering the command "Start ."


    ("Start" mean "launch the following app in a new window". Start understands registered extensions, so you can enter "Start readme.txt" to open that file in notepad. "." is the current directory. Directories are mapped to Explorer)

  • User profile image
    Dave

    You know that good old original File Manager from NT4 days , with its "step up" add-in, will beat the pants off explorer any day in any version of Windows.

  • User profile image
    joebri

    Some great tips here - thank you. 

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.