2

What command can I use to confirm that I am running the command prompt elevated and what command can I use to force a program to run elevated from the command prompt?

3 Answers 3

2

Use the runas command:

alt text

You can find more info in the Vista help.

0

to see whether the currently open command window has the priviledges you need, use whoami /groups This will show all the groups / tokens currently in use. Local admins would show up as NTAuthority\Administrators, which is probably what you are looking for. If your normal account is in this group anyway, you need to see if it is using this group "for deny only", in which case you are not elevated.

Personally, I created a new shortcut to CMD.exe, set the properties of the shortcut to run as Administrator (for which I use a different account at UAC), then change the properties of that window to have a different font and background colour (I use yellow text on blue background, your taste may be for lime on magenta, who knows?). I also increase the width and height of the screen, and make the buffer much bigger, as when I am doing admin type things I tend to want to go back further - some of those /? responses are pretty longwinded! Next time I use that shortcut, I do the UAC, then I have a window which looks very different from my non-elevated one.

0

Here some methods to check elevation:

Method 1

openfiles >nul 2>&1

Method 2 (Depreceated in Windows 10)

at >nul

Method 3

net file >nul 2>&1

Method 4

fsutil dirty query %systemDrive% >nul 2>&1

Check %errorlevel% after each command (0=Elevated,1=Non Elevated)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .