Jump to content

Open elevated command prompts from any location


kliu0x52

Recommended Posts

cmdopen20menus.png

CmdOpen

This is like the built-in command window here feature found in Vista and Win7, except that it supports UAC elevation and you don't have to hold down the Shift key to get it.

Tiny, free, and open-source shell extension that supports both x86-32 and x86-64.

Link to comment
Share on other sites

  • 2 weeks later...

You don't need 3rd party software to get this. The following removes the need to hit "shift" without using 3rd party software.

; Elevated command window (open command window here)
[HKEY_CLASSES_ROOT\Directory\shell\cmd]
"Extended"=-

If you want to open a cmd window on the desktop, you still have to press shift.

Link to comment
Share on other sites

Yea, you just got rid of the shift. But that doesn't cover elevation, which is more important (esp. since, at least for me, command prompts are often used for administrative tasks).

"But what about the runas verb?", you ask. First, runas can't be used on the background folder and second, runas is an exclusive verb, which means that if you assign runas to open a command prompt, you can't use it to perform any other elevation tasks on that object.

Link to comment
Share on other sites

The tweak I posted is for the elevated (run as administrator) cmd window. Try it yourself and see.

Yes, all it does is remove the need to press shift, but it works.

Uh, unless you also have UAC disabled (in which case there is no concept of elevation), no, it does not work.

Link to comment
Share on other sites

Ok Mr. Picky, here you go. Works with UAC and on Computer. Doesn't work on desktop or libraries, but who really cares. Still no need for 3rd party software.

; Elevated Command window in context menu (works with UAC)
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open Admin Command Window Here"
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

; Adds it to "Computer" context menu
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas]
@="Open Admin Command Window Here"
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas\command]
@="cmd.exe"

edited to remove accidentally pasted part

Edited by SyntaxError
Link to comment
Share on other sites

Ok Mr. Picky, here you go.

*sigh* If you look back at post #3 in this thread, you will find that I had already addressed the use of the "runas" verb. :rolleyes:

Yes, there's a way to do this without a shell extension using only the registry. This option has always existed since the days when the first powertoy showed us the way over a decade ago, and it's a well-documented method (there's even an article on Technet on using "runas" to elevate a command prompt). In fact, I've used the registry method for years and years. But the whole point is that it's not a perfect method. This addresses the various shortcomings of the registry method. Nobody's forcing you to use the shell extension method; if you think that the simplicity of the registry outweighs its shortcomings, then you are certainly free to do this with the registry.

Link to comment
Share on other sites

Which is my point as well. There's simply no need to ever use 3rd party software for anything if a simple tweak can do the same job.

...IF the simple tweak can accomplish the same thing. Which in this case, it cannot. I didn't go from using a "simple tweak" using "software" just for the fun of it; I got sick of the shortcomings of the "simple tweak" and decided to address them. If you are okay with the shortcomings (and you have made it abundantly clear that you are), then sure, it doesn't make sense to pick this over the registry method. But that's just your personal opinion. Similarly, it is my view that the shortcomings of the old registry method were too annoying.

Edited by kliu0x52
Link to comment
Share on other sites

So you can't get an elevated cmd window on the desktop if UAC is enabled, big deal.

And you can't open multiple cmd windows at once without your tool. Again, so what. Though it's an interesting feature, I'll give you that.

Look, I'm not attacking you or your tool at all, and I never intended to start an argument.

In fact I think it's great for all those who are afraid of the registry, and it does work good. I've used it myself before I started tweaking the Win7 registry and I've recommended it to others and will continue to do so.

I've just never believed in using 3rd party software to do a job when it can be done without it. It's like using a sledgehammer to drive a tack.

Edited by SyntaxError
Link to comment
Share on other sites

I do have one question about your tool though. Why does it install the 32 bit AND the 64 bit dlls?

It's there so that a 32-bit process can make use of it. For example, if you run Firefox (a 32-bit app) and in the Save File dialog (which is just a miniature Explorer instance), you right-click, then you will be loading the 32-bit DLL (since the host process in this case is 32-bit). Most people will not end up using it, but it's there for the sake of completeness. It's the same reason Windows installs a 32-bit copy of every system DLL.

Also, the icon in your screenshot isn't there.

Hmm. Really? The shield icon is a system resource, so it should always be available on NT6+. I see it on Vista and W7RC1 (both x64 and x86). Unless you have altered your system in some unusual way, I can't see what circumstances would cause this system resource to not load... Do you see this problem on a fresh install of Windows? And if you do not see this problem on a fresh install of Windows, would you happen to know what you changed/installed to make this break?

I've just never believed in using 3rd party software to do a job when it can be done without it. It's like using a sledgehammer to drive a tack.

Well, CmdOpen is definitely not the first command prompt shell extension; of all the ones that I am aware of, it's the last one to enter the game. The reason is that I share your sentiment: I prefer a minimally invasive method whenever possible, and so I very stubbornly stuck to using a registry tweak during all those years. But eventually, I got tired of the shortcomings, so I decided to look at the shell extension route. If you call CmdOpen a sledgehammer, then the others would be a wrecking ball. I couldn't bring myself to use a 100KB shell extension to replace a registry tweak, so I rolled my own for a small fraction of the footprint and with as little invasiveness as possible.

Edited by kliu0x52
Link to comment
Share on other sites

1) So you can't get an elevated cmd window on the desktop if UAC is enabled,

2) And you can't open multiple cmd windows at once

I've just never believed in using 3rd party software to do a job when it can be done without it.

so following your own logic, you would end up using the tool. Just because you deem the functions of the solution useless in your operating environment does not mean they are useless for everybody.

@kliu0x52

Thanks for the link, it will be more than useful (and save a crapload of second guessing) when testing deployments.

Link to comment
Share on other sites

I do have one question about your tool though. Why does it install the 32 bit AND the 64 bit dlls?

It's there so that a 32-bit process can make use of it. For example, if you run Firefox (a 32-bit app) and in the Save File dialog (which is just a miniature Explorer instance), you right-click, then you will be loading the 32-bit DLL (since the host process in this case is 32-bit). Most people will not end up using it, but it's there for the sake of completeness. It's the same reason Windows installs a 32-bit copy of every system DLL.

Also, the icon in your screenshot isn't there.

Hmm. Really? The shield icon is a system resource, so it should always be available on NT6+. I see it on Vista and W7RC1 (both x64 and x86). Unless you have altered your system in some unusual way, I can't see what circumstances would cause this system resource to not load... Do you see this problem on a fresh install of Windows? And if you do not see this problem on a fresh install of Windows, would you happen to know what you changed/installed to make this break?

I found your faq about 2 minutes after I posted, so I removed my question.

I haven't altered anything besides registry tweaks for start menu & taskbar options, action center, disable UAC and Aero Snap, and some services settings. I've been using RC1 as my main OS since it was released. Other tools show their icons in the context menu, except yours.

so following your own logic, you would end up using the tool. Just because you deem the functions of the solution useless in your operating environment does not mean they are useless for everybody.

How in the world can you possibly figure I would use the tool instead of a reg tweak? I never said nor implied that I needed or wanted to open multiple command windows at once, only that it was interesting.

And with the tweak I can open a cmd window on the desktop, just not through desktop listed in windows explorer's file pane. You would have known this had you tried it yourself.

Also, I never said nor implied that no one else had a use for the tool. Obviously kliu0x52 has a use for it, which is why he wrote it in the first place. If you had bothered to read my previous post, you would have known that I know others have a use for it, as I clearly stated that I recommend the tool to other people.

This implies people are asking about such a thing.

You need to quit smoking whatever you are on and sober up. Learning a little basic english might help as well.

Edited by SyntaxError
Link to comment
Share on other sites

I currently have your tool installed, UAC disabled, and no cmd window reg tweaks.

There is no icon next to "Open Command Prompt" as shown in your screenshot. I even tried with UAC enabled, and there's still no icon.

It's probably just a bug in the OS. I've noticed a few here and there with other things, like importing .reg files. I know of one guy who claims he had to right click > merge to get his .reg files imported, but all I have to do is double click as always, UAC enabled or not.

Also, it doesn't say "Open Elevated Command Prompt" only "Open Command Prompt"

Edited by SyntaxError
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...