dzsessona / QuickOpener-NetBeans

Sometimes while programming in NetBeans you want to explore a particular file that you are editing on the file system browser, or maybe launch a command in a terminal to do something with it.
52 stars 41 forks source link

[Windows new feature] Open in shell with admin permissions #48

Open d-ph opened 10 years ago

d-ph commented 10 years ago

Hello,

it'd be great if there is a Open in terminal with administrative permissions menu item on Ms Windows. It'd open a cmd with admin rights, so developers could perform administrative level stuff in opened file directory.

Thanks

dzsessona commented 10 years ago

Hello, to be honest i have no idea how to open a shell in windows as administrator, and after a bit of google i cannot find how to do it. To run a command you should be able to prefix it with runas /user:Administrator "cmdName parameters" but to open a shell as admin.... no idea! Please let me know if you find out.

d-ph commented 10 years ago

Indeed, it's quite tricky and counter-intuitive to open a cmd.exe with Administrator rights via non-elevated cmd.exe. It's seems like the only solution is to include a Windows made shortcut .lnk in your plugin package, which has set an option Run as administrator, and that open the elevated shell via this shortcut (which will ask a user, whether he wants to grant Admin rights to this program). More info here. The first solution is what I explained here. You can open the .lnk just like you would open an ordinary .exe in the cmd.exe.

What do you think?