Jump to content

Recommended Posts

Posted (edited)

Probably worth mentioning that dragging a file or folder only works as long as the Command Prompt hasn't been elevated.

 

Also useful is ContextConsole and the PowerShell script below which add elevated Command Prompt and PowerShell options to your context menu. With these, you can do what @dany2010 suggested as this is often quicker than dragging and dropping folders onto Command Prompt windows.

 

tiJLp5EA-r-L.png

 

$menu = 'Open Windows PowerShell'
$command = "$PSHOME\powershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

'directory', 'directory\background', 'drive' | ForEach-Object {
   New-Item -Path "Registry::HKEY_CLASSES_ROOT\$_\shell" -Name runas\command -Force |
   Set-ItemProperty -Name '(default)' -Value $command -PassThru |
   Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
   Set-ItemProperty -Name HasLUAShield -Value ''
}

 

Source: http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/

Edited by Arthur
  • Thanks 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...