JeffBeall
asked on
Vista command shell
I guess Im late coming to the party, but I just noticed in Vista that the command shell needs to be Run as& administrator to do things like ipconfig /release. Is there a switch to Run as& the administrator, so in the run window I could type cmd /some switch?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I believe I may have mis-interpreted your requirements. To evelate from the command prompt, I use a tool written by John Robbins - www.wintellect.com named elevate.exe -
http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/03/27/elevate-a-process-at-the-command-line-in-vista.aspx
It works sufficiently well but the results of any command tend to disappear immediately unless the command independently holds the console window open itself. As a result, I don't run elevate.exe directly, instead I use a one line batch file to wrap it such that the elevate command is prefixed with cmd /k, like this -
@elevate.exe %COMSPEC% /k call echo/ ^& cd /d %CD% ^& echo %CD% = %* ^& %*
... I also abbreviate it to UAC.cmd to reduce typing.
http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/03/27/elevate-a-process-at-the-command-line-in-vista.aspx
It works sufficiently well but the results of any command tend to disappear immediately unless the command independently holds the console window open itself. As a result, I don't run elevate.exe directly, instead I use a one line batch file to wrap it such that the elevate command is prefixed with cmd /k, like this -
@elevate.exe %COMSPEC% /k call echo/ ^& cd /d %CD% ^& echo %CD% = %* ^& %*
... I also abbreviate it to UAC.cmd to reduce typing.
I use that also and created a batch file to wrap it named admincmd.bat:
@echo off
setlocal
if "%~1"=="" elevate cmd&goto :EOF
set tempFile=%temp%\_temp.bat
(echo @%*)>"%tempFile%"
(echo @pause)>>"%tempFile%"
elevate "%tempFile%"
del "%tempFile%"
This way you can say:
admincmd
To get a new DOS box that runs with elevated privileges.
Another example is:
admincmd ipconfig /renew
Will run ipconfig with the /renew option using elevated privileges.
@echo off
setlocal
if "%~1"=="" elevate cmd&goto :EOF
set tempFile=%temp%\_temp.bat
(echo @%*)>"%tempFile%"
(echo @pause)>>"%tempFile%"
elevate "%tempFile%"
del "%tempFile%"
This way you can say:
admincmd
To get a new DOS box that runs with elevated privileges.
Another example is:
admincmd ipconfig /renew
Will run ipconfig with the /renew option using elevated privileges.
Hehe ... great minds as they say :0)
Mine does virtually the same thing I think. If I type "uac", I get a new elevated shell in the same drive and directory as the one that spawned it that remains open. If I type "uac ipconfig /flushdns", I get a new elevated shell as above that writes the executed command to the second line and then runs it and remains.
Mine does virtually the same thing I think. If I type "uac", I get a new elevated shell in the same drive and directory as the one that spawned it that remains open. If I type "uac ipconfig /flushdns", I get a new elevated shell as above that writes the executed command to the second line and then runs it and remains.
...adding the place in current directory idea from MSE-dwells ;)
ASKER