I want to start Notepad with elevated privileges to edit C:\Windows\System32\drivers\etc\host. Notmally I would type notepad in the search box, and with the program highlighted hot Ctrl + Shift + Enter, click Yes on the UAC prompt and then open the file. I do this often, so I want a batch file to do it.
I tried the following command:
runas /user:Administrator /savecred notepad.exe path\to\file
But this is not exactly what I want, as it prompts for the password of the Administrator account. I really want a command to start a program with elevated privileges for the current user account.
I run Windows 7 RC.
Start-Process -Verb runas notepad.exe
or from cmd with shorthandpowershell -c start -verb runas notepad.exe
. PowerShell's-Verb runas
does not require switching users as the standalonerunas
command does.