I was wondering how to open a file with notepad
or, if possible, notepad++
from a non-elevated mode in Windows PowerShell. By this I mean, how can I open a file using a command like notepad $profile
without having to first have started the current session with administrative privileges? Also, instead of using notepad
, will it be possible to use a different program like notepad++
instead?
Asked
Active
Viewed 954 times
1

JasonMArcher
- 14,195
- 22
- 56
- 52

Amndeep7
- 2,022
- 4
- 17
- 26
-
I don't understand your question, PowerShell (and other apps) run non-elevated by default. – JasonMArcher Mar 13 '12 at 16:05
1 Answers
2
Use Start-Process
with the RunAs
verb:
Start-Process notepad $profile -Verb runas
This will run notepad elevated.
To use a different program just specify it's path instead of notepad.

Andy Arismendi
- 50,577
- 16
- 107
- 124
-
I've only recently started messing around with PowerShell (as in today), so could you explain what that verb thing is at the end? – Amndeep7 Feb 23 '12 at 01:49
-
1Verbs are per file type actions. For example Print for a text file, Play for an audio file. You can view what verbs are available by doing this: `New-Object System.Diagnostics.ProcessStartInfo "C:\SomeFile.txt" | Select -Expand Verbs`. The `RunAs` verb invokes elevation. – Andy Arismendi Feb 23 '12 at 01:54