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...
"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!
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 ;)
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]
4. Press enter and see it launch that app as Administrator with the working directory set correctly