A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Cmd prompt as Administrator with elevated privilages



 
 
Thread Tools Rate Thread Display Modes
  #16  
Old June 27th 17, 12:46 PM posted to alt.comp.os.windows-10,alt.windows7.general
Big Al[_7_]
external usenet poster
 
Posts: 177
Default Cmd prompt as Administrator with elevated privilages

On 06/27/2017 01:24 AM, Lucifer Morningstar wrote:
On Tue, 27 Jun 2017 03:56:54 +0000 (UTC), Lionel Muller
wrote:

I just want open the command prompt as administrator in as few keystrokes
or mouse clicks as possible.

How can I open the command prompt as administrator with elevated privileges
without having to give up and resort to a menu based search just to find
what should be obvious.

What's the shortest number of key presses or mouse clicks to just open a
command prompt as administrator?

I use the classic menu on Windows10 and I never use Cortana or any search
for anything other than to find the command prompt (which is a silly use
model because that's the only thing that I ever need a search to do!).

Best would be to make a right click context menu that just says
Open cmd as administrator here.

Second best would be some magical keystroke that just opens up the command
prompt as administrator.

Worst best is to create a shortcut and have to dock it to the screen just
to open a command prompt as administrator.

How can I open the command prompt as administrator with elevated privileges
without having to give up and resort to a menu based search and in the
least number of mouse clicks or menu selections (using the classic menu) as
possible?


Search for CMD. Right click command prompt. Select open file location.
Right drag command prompt to desktop. Select create shortcuts here.
To use right click desktop shortcut. Select run as administrator.

Once you make the shortcut, can't you go into properties and check a box
for "run as administrator" that does it automatically?!

Ads
  #17  
Old June 27th 17, 12:47 PM posted to alt.comp.os.windows-10,alt.windows7.general
Big Al[_7_]
external usenet poster
 
Posts: 177
Default Cmd prompt as Administrator with elevated privilages

On 06/27/2017 03:17 AM, Andy Burns wrote:
Lionel Muller wrote:

I just want open the command prompt as administrator in as few keystrokes
or mouse clicks as possible.


Right click the desktop (or another convenient folder, possibly within
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\)

select NewShortcut

For location simply enter CMD

for name enter something like Admin CMD prompt

Click finish

Right click the newly created shortcut and select Properties

Click the Advanced button and tick the Run as Adminstrator box

OK, OK

+1
I responded the same thought to someone else, just didn't get far enough
down to see your reply. I use this in a lot of shell scripts that need
admin priv to run.
  #18  
Old June 27th 17, 01:09 PM posted to alt.comp.os.windows-10,alt.windows7.general
Lucifer Morningstar[_2_]
external usenet poster
 
Posts: 368
Default Cmd prompt as Administrator with elevated privilages

On Tue, 27 Jun 2017 07:46:07 -0400, Big Al wrote:

On 27/06/2017 01:24 AM, Lucifer Morningstar wrote:
On Tue, 27 Jun 2017 03:56:54 +0000 (UTC), Lionel Muller
wrote:

I just want open the command prompt as administrator in as few keystrokes
or mouse clicks as possible.

How can I open the command prompt as administrator with elevated privileges
without having to give up and resort to a menu based search just to find
what should be obvious.

What's the shortest number of key presses or mouse clicks to just open a
command prompt as administrator?

I use the classic menu on Windows10 and I never use Cortana or any search
for anything other than to find the command prompt (which is a silly use
model because that's the only thing that I ever need a search to do!).

Best would be to make a right click context menu that just says
Open cmd as administrator here.

Second best would be some magical keystroke that just opens up the command
prompt as administrator.

Worst best is to create a shortcut and have to dock it to the screen just
to open a command prompt as administrator.

How can I open the command prompt as administrator with elevated privileges
without having to give up and resort to a menu based search and in the
least number of mouse clicks or menu selections (using the classic menu) as
possible?


Search for CMD. Right click command prompt. Select open file location.
Right drag command prompt to desktop. Select create shortcuts here.
To use right click desktop shortcut. Select run as administrator.

Once you make the shortcut, can't you go into properties and check a box
for "run as administrator" that does it automatically?!


Yes! Actually under properties then advanced.
Thank you!
  #19  
Old June 27th 17, 01:44 PM posted to alt.comp.os.windows-10,alt.windows7.general
Jonathan N. Little[_2_]
external usenet poster
 
Posts: 1,133
Default Cmd prompt as Administrator with elevated privilages

Lucifer Morningstar wrote:
On Tue, 27 Jun 2017 07:42:49 +0100 (BST), "Rodney Pont"
wrote:

On Tue, 27 Jun 2017 15:26:36 +1000, Lucifer Morningstar wrote:

Right-click on Windows icon on taskbar Command Prompt (Admin) [after
you switch from Powershell back to Command shell in settings]

That won't work as the option to run as administrator is not available
from the taskbar.


It is and always has been available on my Windows 10 system.


Not available on my desktop Windows 10 Pro 32 bit I5 quad core.
4 GB RAM.
Not available on my laptop Windows 10 home 64 bit I7 quad core.


http://www.littleworksstudio.com/temp/usenet/cmd-prompt

As I said, after CU you will not see this, because MS changed it to
PowerShell. To restore it Settings Personalization Taskbar and turn
off Replace Command Prompt with Windows PowerShell in then menu...

Also there it lists hotkey Win+X to show this menu rather than
right-clicking Windows' icon.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
  #20  
Old June 27th 17, 01:46 PM posted to alt.comp.os.windows-10,alt.windows7.general
Mr. Man-wai Chang
external usenet poster
 
Posts: 1,941
Default Cmd prompt as Administrator with elevated privilages

On 27/6/2017 11:56 AM, Lionel Muller wrote:
I just want open the command prompt as administrator in as few keystrokes
or mouse clicks as possible.
How can I open the command prompt as administrator with elevated privileges
without having to give up and resort to a menu based search just to find
what should be obvious.

What's the shortest number of key presses or mouse clicks to just open a
command prompt as administrator?


There is a command-line utility to elevate your privilege from within a
non-privileged command prompt. Google for it.

--
@~@ Remain silent! Drink, Blink, Stretch! Live long and prosper!!
/ v \ Simplicity is Beauty!
/( _ )\ May the Force and farces be with you!
^ ^ (x86_64 Ubuntu 9.10) Linux 2.6.39.3
不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):
http://www.swd.gov.hk/tc/index/site_...sub_addressesa
  #21  
Old June 27th 17, 04:11 PM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default Cmd prompt as Administrator with elevated privilages

For alt.comp.os.windows-10,alt.windows7.general Jonathan N. Little wrote:

Also there it lists hotkey Win+X to show this menu rather than
right-clicking Windows' icon.


The consensus is that Win+X,A is the shortest keyboard sequence.

To further improve for everyone, is there a way to change the default cwd?
FROM: C:\WINDOWS\system32
TO: (a user-defined cwd, e.g., C:\Users\xxx\)
  #22  
Old June 27th 17, 05:33 PM posted to alt.comp.os.windows-10,alt.windows7.general
Jonathan N. Little[_2_]
external usenet poster
 
Posts: 1,133
Default Cmd prompt as Administrator with elevated privilages

Lionel Muller wrote:
For alt.comp.os.windows-10,alt.windows7.general Jonathan N. Little wrote:

Also there it lists hotkey Win+X to show this menu rather than
right-clicking Windows' icon.


The consensus is that Win+X,A is the shortest keyboard sequence.

To further improve for everyone, is there a way to change the default cwd?
FROM: C:\WINDOWS\system32
TO: (a user-defined cwd, e.g., C:\Users\xxx\)


Once switching default from PowerShell to CMD holding SHIFT and
right-click menu in Explorer "Open command window here". For a generic
default I think you will have to create a batch file for that, because
if you think about it when running as Administrator you are not
associated with specific user.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
  #23  
Old June 27th 17, 07:00 PM posted to alt.comp.os.windows-10,alt.windows7.general
mike[_10_]
external usenet poster
 
Posts: 1,073
Default Cmd prompt as Administrator with elevated privilages

On 6/27/2017 5:46 AM, Mr. Man-wai Chang wrote:
On 27/6/2017 11:56 AM, Lionel Muller wrote:
I just want open the command prompt as administrator in as few keystrokes
or mouse clicks as possible.
How can I open the command prompt as administrator with elevated
privileges
without having to give up and resort to a menu based search just to find
what should be obvious.

What's the shortest number of key presses or mouse clicks to just open a
command prompt as administrator?


There is a command-line utility to elevate your privilege from within a
non-privileged command prompt. Google for it.

What's the definition of "elevated privileges"?
I haven't tried to get below two clicks, but powerrun will
let you run as trusted installer.
  #24  
Old June 27th 17, 08:11 PM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default Cmd prompt as Administrator with elevated privilages

For alt.comp.os.windows-10,alt.windows7.general Jonathan N. Little wrote:


Once switching default from PowerShell to CMD holding SHIFT and
right-click menu in Explorer "Open command window here". For a generic
default I think you will have to create a batch file for that, because
if you think about it when running as Administrator you are not
associated with specific user.


I solved the problem but I'm sure there are better ways to solve it.
Start Run cmda

That pops up the command window in any desired location.
http://img4.imagetitan.com/img.php?i..._admincmd1.gif

All I needed was a single line in the registry to effect it.
http://img4.imagetitan.com/img.php?i..._admincmd2.gif

If you want to try this, here's what I did.

*1* I doubleclicked on this admincmd.reg file.
start

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App
Paths\cmda.exe]
@="C:\\Users\\xxx\\Desktop\\admincmd.bat"
end


*2* I created this admincmd.bat file on my desktop (it can be anywhere).
start

@ECHO OFF

REM Open a new shell "Run As Administrator"
REM Based on script by foxidrive on alt.msdos.batch

SETLOCAL ENABLEEXTENSIONS

IF NOT "%~1"=="" goto :START

SET MyFile=%TEMP%\Admin.vbs"
Echo Set UAC = CreateObject("Shell.Application") "%MyFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 "%MyFile%"
Start "" /MIN "%MyFile%"
goto :EOF

:START
Cmd /k "CD /D "%*" & Echo Administrator: & color 4F"
end


*3* That makes this command open an admin window wherever you want:
Start Run cmda


If you can think of ways to streamline this process, I'm always open to
suggestions that make opening an Admin command windows where you want it to
open more efficient.

I would like, for example, someone to suggest a method of adding an "Open
Admin cmd window here" in the right-click context menu list of options.
  #25  
Old June 27th 17, 09:03 PM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default Cmd prompt as Administrator with elevated privilages

For alt.comp.os.windows-10,alt.windows7.general Jonathan N. Little wrote:

Right-click on Windows icon on taskbar Command Prompt (Admin) [after
you switch from Powershell back to Command shell in settings]


This was yet another great streamlining idea to open an admin command
prompt, but I had to modify it because I'm using the classic shell.

That means the RightClick didn't work but the ShiftRightClick did work!
http://img4.imagetitan.com/img.php?i..._admincmd3.gif

I'm sure it works the way you said for those not using Classic Shell.
  #26  
Old June 28th 17, 01:39 AM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default Cmd prompt as Administrator with elevated privilages

For alt.comp.os.windows-10,alt.windows7.general Lionel Muller wrote:


I just want open the command prompt as administrator in as few keystrokes
or mouse clicks as possible.


All suggestions are working great except for the lack of ability to change
a command-prompt shortcut to open itself in a desired folder outside of
Windows\System32.

With that one failure in mind, how is this as a summary of the other
successes?

A. Keyboard:
Windows+X,A (Creator's edition is slightly different I'm told.)
B. Command:
Start Run cmda
(Needs a one-time setup: See cmda.reg & cmda.bat below.)
http://img4.imagetitan.com/img.php?i..._admincmd1.gif
http://img4.imagetitan.com/img.php?i..._admincmd2.gif
C. Menu:
Shift-Rightclick on the Windows-icon Command Prompt (Admin)
Note: Non-classic users should be able to omit the "Shift".
http://img4.imagetitan.com/img.php?i..._admincmd3.gif
D. Shortcut:
Rightclick in any folder (e.g., the Desktop) New Shortcut
For a location, simply type "cmd" (sans quotes)
Click Next & click Finish.
Rightclick the new Shortcut Properties Shortcut Advanced
Check [x]Run as Administrator
Or
Windows search for the keyword "CMD".
Right click on the resultant "Command Prompt - Desktop app".
Select "Open file location" which brought me to a terrible location:
C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Sta rt Menu\Programs\Windows System\
where you'll find a "Command Prompt" shortcut set to:
Target = %windir%\system32\cmd.exe
Start in = %HOMEDRIVE%%HOMEPATH%
Shortcut key = not set
Right drag a copy of that Command Prompt shortcut to your desktop.
Right click on that "Command Prompt" & select "Run as Administrator".
(Optionally, set properties as desired.)
Rightclick the new Shortcut Properties Shortcut Advanced
Check [x]Run as Administrator
================================================== ====================
***** start cmda.reg *****
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App
Paths\cmda.exe]
@="C:\\Users\\xxx\\Desktop\\cmda.bat"
***** end cmda.reg *****
***** start cmda.bat *****
@ECHO OFF

REM Open a new shell "Run As Administrator"
REM Based on script by foxidrive on alt.msdos.batch

SETLOCAL ENABLEEXTENSIONS

IF NOT "%~1"=="" goto :START

SET MyFile=%TEMP%\Admin.vbs"
Echo Set UAC = CreateObject("Shell.Application") "%MyFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 "%MyFile%"
Start "" /MIN "%MyFile%"
goto :EOF

:START
Cmd /k "CD /D "%*" & Echo Administrator: & color 4F"
***** end cmda.bat *****
================================================== ====================
Improvements to our combined tribal knowledge are always requested.
  #27  
Old June 28th 17, 01:52 AM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default Cmd prompt as Administrator with elevated privilages

For alt.comp.os.windows-10,alt.windows7.general Lionel Muller wrote:

All suggestions are working great except for the lack of ability to change
a command-prompt shortcut to open itself in a desired folder outside of
Windows\System32.


This solves the problem of ad-hoc locality.

A. Create CmdHereAsAdmin.inf file shown below.
B. Right click on that inf file and select Install.
C. Right click on any folder in Windows Explorer where a new menu appears:
"CMD here as Admin"

*** begin CmdHereAsAdmin.inf ***
[version]
signature="$CHICAGO$"

[CmdHereAsAdminInstall]
CopyFiles = CmdHereAsAdmin.Files.Inf
AddReg = CmdHereAsAdmin.AddReg

[DefaultInstall]
CopyFiles = CmdHereAsAdmin.Files.Inf
AddReg = CmdHereAsAdmin.AddReg

[DefaultUnInstall]
DelFiles = CmdHereAsAdmin.Files.Inf
DelReg = CmdHereAsAdmin.DelReg

[SourceDisksNames]
55="CMD Prompt Here as Administrator","",1

[SourceDisksFiles]
CmdHereAsAdmin.INF=55

[DestinationDirs]
CmdHereAsAdmin.Files.Inf = 17

[CmdHereAsAdmin.Files.Inf]
CmdHereAsAdmin.INF

[CmdHereAsAdmin.AddReg]
HKLM,%UDHERE%,DisplayName,,"%CmdHereAsAdminName%"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe
syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132
%17%\CmdHereAsAdmin.inf"
HKCR,Directory\Shell\runas,,,"%CmdHereAsAdminAccel %"
HKCR,Directory\Shell\runas\command,,,"%11%\cmd.exe /k cd /d ""%1"""
HKCR,Drive\Shell\runas,,,"%CmdHereAsAdminAccel%"
HKCR,Drive\Shell\runas\command,,,"%11%\cmd.exe /k cd /d ""%1"""

[CmdHereAsAdmin.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\runas
HKCR,Drive\Shell\runas

[Strings]
CmdHereAsAdminName="CMD Prompt Here as Administrator PowerToy (Uninstall
only)"
CmdHereAsAdminAccel="CMD here as Admin"
UDHERE="Software\Microsoft\Windows\CurrentVersion\ Uninstall\CmdHereAsAdmin"
*** end CmdHereAsAdmin.inf ***
  #28  
Old June 28th 17, 11:46 AM posted to alt.comp.os.windows-10,alt.windows7.general
Lionel Muller
external usenet poster
 
Posts: 119
Default Cmd prompt as Administrator with elevated privilages

For alt.comp.os.windows-10 Andy Burns wrote:


No matter what I did to the "Start in" field, it still opened in System32.


Try passing /K "cd /d C:\wherever" as arguments to cmd.exe in the shortcut


That suggestion worked perfectly with the "/K" with or without the "/d"!
http://img4.imagetitan.com/img.php?image=16_cmda_1.gif

Thanks!
http://img4.imagetitan.com/img.php?image=16_cmda_2.gif
  #29  
Old June 29th 17, 02:47 AM posted to alt.comp.os.windows-10,alt.windows7.general
Jason
external usenet poster
 
Posts: 878
Default Cmd prompt as Administrator with elevated privilages

On Tue, 27 Jun 2017 03:56:54 +0000 (UTC) "Lionel Muller"
wrote in article oisl26$1hcd$1
@gioia.aioe.org

How can I open the command prompt as administrator with elevated privileges
without having to give up and resort to a menu based search and in the
least number of mouse clicks or menu selections (using the classic menu) as
possible?


Define a desktop shortcut for cmd with admin privileges. I use it all the
time.
  #30  
Old June 29th 17, 05:06 AM posted to alt.comp.os.windows-10,alt.windows7.general
B00ze
external usenet poster
 
Posts: 472
Default Cmd prompt as Administrator with elevated privilages

On 2017-06-27 15:11, Lionel Muller wrote:

If you can think of ways to streamline this process, I'm always open to
suggestions that make opening an Admin command windows where you want it to
open more efficient.

I would like, for example, someone to suggest a method of adding an "Open
Admin cmd window here" in the right-click context menu list of options.


You can use this:
http://code.kliu.org/cmdopen/

WinAero Tweaker also has an option to add Open Admin Prompt to context
menu in Explorer but the menu entry is a bit long so I prefer using
Kliu's...

Best Regards,

--
! _\|/_ Sylvain /
! (o o) Memberavid-Suzuki-Fdn/EFF/Red+Cross/SPCA/Planetary-Society
oO-( )-Oo Is there a banker in the house? -=}BLAM{=- Any more?

 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 12:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 PCbanter.
The comments are property of their posters.