Powershell Tips–PSEdit


I got this from watching a session from Jeffrey Snover at TechEd. It was a neat trick, and it’s worked better than what I used to do.

Editing files

Suppose I have the ISE open and I want to edit a file. I could easily do this:


Click File –> Open, or click the open Folder button, and get a dialog to open a file. I stopped doing that soon after I began playing with PowerShell because I was typing most of the time, and it was easier to do this:


Just type notepad and the filename, whether it exists or not, and have notepad open up. However working with notepad isn’t great because you lose intellisense and some of the other nice ISE features.

However today I saw this. Type psedit and a file (it has to exist).

psedit  attachdbs.ps1

And I see the file open above.


Very cool.

Of course, as I mentioned, the file needs to exist. If it doesn’t, then a CTRL+N will get you a new file, which you can save and then easily open from the command line the next time.

Filed under: Blog Tagged: powershell, syndicated