Elevating privilege in command prompt

S

Stan Brown

This is so bizarre that I thought I'd share.

I wanted to convert an external drive to NTFS from FAT32. So I
right-clicked on "Command Prompt" in the Start menu, selected Run As
Administrator, then typed the Convert command.

Bang "Access Denied" and a message that I must run in elevated mode
to do that command.

Check Windows help. Advice is to right-click the command prompt and
do Run As Administrator, then type the command. Exactly what didn't
work, in other words.

Fortunately, on the Web I found an alternative that did work: click
the Start button, type cmd in the search window, and then Ctrl-Shift-
Enter.

I've no idea why one form of running as administrator let me execute
the Convert command and the other one didn't, but I'd like to know.
Anyone have any ideas?
 
D

Dave-UK

Stan Brown said:
This is so bizarre that I thought I'd share.

I wanted to convert an external drive to NTFS from FAT32. So I
right-clicked on "Command Prompt" in the Start menu, selected Run As
Administrator, then typed the Convert command.

Bang "Access Denied" and a message that I must run in elevated mode
to do that command.

Check Windows help. Advice is to right-click the command prompt and
do Run As Administrator, then type the command. Exactly what didn't
work, in other words.

Fortunately, on the Web I found an alternative that did work: click
the Start button, type cmd in the search window, and then Ctrl-Shift-
Enter.

I've no idea why one form of running as administrator let me execute
the Convert command and the other one didn't, but I'd like to know.
Anyone have any ideas?
No idea really.
When you select 'run as administrator' on the Start menu Command
Prompt does the UAC dialog kick in ?
 
J

Jeff Layman

Stan Brown said:
This is so bizarre that I thought I'd share.

I wanted to convert an external drive to NTFS from FAT32. So I
right-clicked on "Command Prompt" in the Start menu, selected Run As
Administrator, then typed the Convert command.

Bang "Access Denied" and a message that I must run in elevated mode
to do that command.

Check Windows help. Advice is to right-click the command prompt and
do Run As Administrator, then type the command. Exactly what didn't
work, in other words.

Fortunately, on the Web I found an alternative that did work: click
the Start button, type cmd in the search window, and then Ctrl-Shift-
Enter.

I've no idea why one form of running as administrator let me execute
the Convert command and the other one didn't, but I'd like to know.
Anyone have any ideas?
No idea, but there is a difference as you have found.

Start menu | All Programs | Accessories | Command Prompt - right click and
run as administrator:-
Title line is "Administrator: Command Prompt"
Command entry line is "C:\Windows\System32"

Start button, type cmd in the search window, and then Ctrl-Shift-Enter:-
Title line is "Administrator: C:\Windows\system32\cmd.exe
Command entry line is "C:\Windows\System32"

Start menu | All Programs | Accessories | Command Prompt and
Ctrl-Shift-Enter:-
Title line is "Command Prompt"
Command entry line is "C:\Users\<me>" (ie the same as just left-clicking on
Command Prompt)

Why is there a difference in the title line with the first two when the
command entry line is the same?
 
J

johnbee

Stan Brown said:
This is so bizarre that I thought I'd share.

I wanted to convert an external drive to NTFS from FAT32. So I
right-clicked on "Command Prompt" in the Start menu, selected Run As
Administrator, then typed the Convert command.

Bang "Access Denied" and a message that I must run in elevated mode
to do that command.

Check Windows help. Advice is to right-click the command prompt and
do Run As Administrator, then type the command. Exactly what didn't
work, in other words.

Fortunately, on the Web I found an alternative that did work: click
the Start button, type cmd in the search window, and then Ctrl-Shift-
Enter.

I've no idea why one form of running as administrator let me execute
the Convert command and the other one didn't, but I'd like to know.
Anyone have any ideas?
Sorry if this is a bit basic for you, but 'running the command prompt' as an
administrator is not at all the same as typing CMD in the start box and then
right clicking CMD and running as administrator. So they won't do the same
thing. Next time you do it, look at the window that opens for you to type
in commands. Look especially at the blue band at the top: if the title
starts with the word ADMINISTRATOR you've cracked elevation: if it doesn't
you haven't.
 
D

Dave-UK

johnbee said:
Sorry if this is a bit basic for you, but 'running the command prompt' as an administrator is not
at all the same as typing CMD in the start box and then right clicking CMD and running as
administrator. So they won't do the same thing. Next time you do it, look at the window that
opens for you to type in commands. Look especially at the blue band at the top: if the title
starts with the word ADMINISTRATOR you've cracked elevation: if it doesn't you haven't.
I don't get any difference between running :
Start > All programs > Accessories > Command Prompt as
an administrator and right-clicking the Start search box cmd.exe and
running as administrator. Which ever method I use I still end up with
the title bar showing 'Administrator: '
 
S

Seth

Stan Brown said:
Fortunately, on the Web I found an alternative that did work: click
the Start button, type cmd in the search window, and then Ctrl-Shift-
Enter.

I've no idea why one form of running as administrator let me execute
the Convert command and the other one didn't, but I'd like to know.
Anyone have any ideas?
The difference wasn't the right-click/run-as vs. Ctrl-Shift-Enter but rather
in the first instance you used the legacy "command" while in the 2nd (the
one that worked) you used the newer version "cmd". The 2 processors behave
very differently under different circumstances.

I stopped using "command" years ago.
 
S

Stan Brown

No idea really.
When you select 'run as administrator' on the Start menu Command
Prompt does the UAC dialog kick in ?
Yes, it does. "Do you want to allow the following program to make
changes to this computer?"

If I didn't mention it before, this is Home Premium and I'm using the
default "Owner" account. I haven't messed with its privileges,
though I have changed its name.
 
S

Stan Brown

I don't get any difference between running :
Start > All programs > Accessories > Command Prompt as
an administrator and right-clicking the Start search box cmd.exe and
running as administrator. Which ever method I use I still end up with
the title bar showing 'Administrator: '
And I do too. That was the problem: the command prompt was running
as administrator (shown in title bar) but still "convert" said I
needed to elevate privilege.

Following Jeff's note, I compared the two. Like him, opening each way
I got "Administrator" in the window title, but one showed the path to
the executable and the other just showed "command prompt".

I notice that Windows 7 no longer has a Runas command, so creating a
shortcut to the command prompt run as administrator is out.
 
S

Stan Brown

The difference wasn't the right-click/run-as vs. Ctrl-Shift-Enter but rather
in the first instance you used the legacy "command" while in the 2nd (the
one that worked) you used the newer version "cmd". The 2 processors behave
very differently under different circumstances.
Thanks for posting, but I don't think that can be it. The "Command
Prompt" shortcut in my Start Menu shows this as target when I right-
click it and select Properties:

%windir%\system32\cmd.exe

and there is no "command.exe" in my Windows\System32 folder -- no
"command.com" either, come to that.
 
S

Seth

Stan Brown said:
Thanks for posting, but I don't think that can be it. The "Command
Prompt" shortcut in my Start Menu shows this as target when I right-
click it and select Properties:

%windir%\system32\cmd.exe

and there is no "command.exe" in my Windows\System32 folder -- no
"command.com" either, come to that.
I misread your description. I originally read it as you did a start-run
"command" and then right clicked that, not that you right-clicked the
"Command Prompt" icon.

After thinking about it further, the only other difference I can think of is
because of the "Start in" path. Depending on how you have your profile
security setup the access denied may not have been for the attempt to run
"convert.exe", but rather for trying to do anything in the path you were in.
When CMD is run via the "search" box, the "Start in" properties aren't used
and that could make a difference.

Kind of how on some systems you attempt to right-click a file that's on a
network resource and choose to "Run as administrator", that attempts to run
something from a network resource using a local account that has no access.

Also, the "Command Prompt" shortcut is physically located within your
profile rather than a common location like the "cmd.exe" executable is.
 
G

GTS-NJ

I notice that Windows 7 no longer has a Runas command, so creating a
shortcut to the command prompt run as administrator is out.
Not so. Click the Advanced button on the Shortcut tab to access the Run As
Administrator check box.
 
P

Percival P. Cassidy

I don't get any difference between running :
Start > All programs > Accessories > Command Prompt as
an administrator and right-clicking the Start search box cmd.exe and
running as administrator. Which ever method I use I still end up with
the title bar showing 'Administrator: '
I *think* you get command prompt with elevated privilege by pressing
Shift-Enter or Control-Enter rather than just Enter.

Perce
(who uses Windows only when he absolutely must)
 
I

Ignacio Shagnasty

Ibrahim Al-Qassam (Abdelaziz) said:
It is very bizzare.
Talk to Psychiatrist
Why don't you give him your psychiatrist's number? Oh, you take up all his
time. Never mind!
 
J

Joe Morris

[thread on when admin prompt isn't really elevated]
I notice that Windows 7 no longer has a Runas command, so creating a
shortcut to the command prompt run as administrator is out.
It may be related to the particular version of win7 you're using, but on my
system - 64-bit Windows 7 Enterprise - the RunAs command is alive and well,
living in C:\Windows\System32, datestamped 13 July 2009, version
6.1.7600.16385 .

But that probably wouldn't help in the subject being discussed here; since
it seems that all of the userids involved that people have been referring to
are already local administrators, the issue is when the administrator
*token* is held by a process.

Testing in a virtual machine I created a small disk, formatted it FAT32, and
tried running the Convert command. Starting the command window in a number
of ways *all* got the token (after UAC requested permission), made
C:\Windows\System32 the current folder, but did have different title bar
text...but the CONVERT command ran successfully each time it was started in
a window where the title bar was automatically populated with text beginning
"Administrator:" and failed everywhere else.

1/
Type CMD into the search box, right-click the matching item at the top of
the window, select "Run as Administrator".

Title bar: Administrator: C:\Windows\System32\cmd.exe

2/
Click "All Programs", select Accessories, right-click "Command Prompt",
select "Run as Administrator"

Title bar: Administrator: Command Prompt

3/
Type CMD into the search box, then CTRL+SHIFT+ENTER

Title bar: Administrator: C:\Windows\system32\cmd.exe

[[ Note the slight difference in the title bar: "system32" vs.
"System32". ]]


4/
Copy the "Command Prompt" shortcut in the START menu to the desktop, open
the properties dialog, select "Run as Administrator". Double-click the
icon.

Title bar: Administrator: Admin Command Prompt

[[ The string "Admin Command Prompt" is the name of the shortcut I put on
the desktop ]]


and as a final test, I created a new local account ("jcm") and added it to
the local Administrators group. Open a normal command window and issue the
command:

runas /user:jcm cmd

The title bar of the (new) window is

cmd (running as WIN7-64-C\jcm)

[[ WIN7-64-C is the hostname ]]

and the current folder is C:\Windows\system32, but the process does NOT hold
the administrator token (not surprising). Attempting to run CONVERT was
quickly shot down with an access denied error message.


Joe
 
S

Stan Brown

Not so. Click the Advanced button on the Shortcut tab to access the Run As
Administrator check box.
There is indeed that check box. Unfortunately I no longer have a
FAT32 drive, so I can't test whether it works like Ctrl-Shift-Enter
(elevating privilege) or like right-clicking and selecting Run As
Administrator (without elevating privilege).

Please quote properly: identify the previous poster (which was em in
this case), and trim away the signature and all else irrelevant to
your follow-up.
 
S

Stan Brown

After thinking about it further, the only other difference I can think of is
because of the "Start in" path. Depending on how you have your profile
security setup the access denied may not have been for the attempt to run
"convert.exe", but rather for trying to do anything in the path you were in.
When CMD is run via the "search" box, the "Start in" properties aren't used
and that could make a difference.
When I right-click the Start Menu shortcut and select Run As
Administrator, it opens in C:\Windows\system32 (lower-case system32)
with a window title of Administrator: Command Prompt.

When I make a copy of that shortcut on my desktop and check the "Run
As Administrator" box in Properties » Advanced, then click the edited
icon, the opening directory and title are the same as above.

When I search cmd and hit Ctrl-Shift-Enter, it opens in the same
folder, even including the lower-case s, but the window title is
Administrator: C:\Windows\system32\cmd.exe

In each of the three cases I do get the prompt about allowing the
command to make changes to my computer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top