Open Scripts in a new tab in the PowerShell ISE using PSEdit

While at TechEd last week, PSEdit was used in one of the PowerShell sessions that I sat through. Afterwards a couple of friends asked me if I had ever heard of it and said they hadn’t so I thought I would write a blog article about it to help spread the word.

PSEdit is a function that only exists in the PowerShell ISE. Type in PSEdit followed by the name of a PowerShell script and that script will be opened in a new tab in the ISE:

051814-1

Try the same thing in the PowerShell console and you’ll end up with an error message:

051814-2

Since psEdit is a function and not a compiled cmdlet, you can take a look under the covers to see what it does behind the scenes:

051814-3

There’s very little help for psEdit and this is even after running Update-Help from within the PowerShell ISE:

051814-4

Even though the filenames parameter doesn’t show it accepting an array [], based on the code and a little testing, a common separated list can be used to open multiple scripts:

051814-5

I’ve actually written a previous blog article to locate and open scripts in the PowerShell ISE that uses the same behind the scenes code as psEdit that you may also find interesting.

µ

About Mike F Robbins

Mike F Robbins is a Microsoft MVP on Windows PowerShell and a SAPIEN Technologies MVP. He is a co-author of Windows PowerShell TFM 4th Edition and is a contributing author of a chapter in the PowerShell Deep Dives book. Mike has written guest blog articles for the Hey, Scripting Guy! Blog, PowerShell Magazine, and PowerShell.org. He is the winner of the advanced category in the 2013 PowerShell Scripting Games. Mike is also the leader and co-founder of the Mississippi PowerShell User Group. He blogs at mikefrobbins.com and can be found on twitter @mikefrobbins.
This entry was posted in PowerShell and tagged . Bookmark the permalink.

One Response to Open Scripts in a new tab in the PowerShell ISE using PSEdit

  1. Graeme says:

    After playing with this, you can also open anything that may have the string ‘DHCP’ in the title for example, if your version control is -v1 -v2 etc. Typing on my phone, but I think you get the point.

    You can just the wildcard of * if I remember correctly.

    You do have to be in the same directory of course.

Leave a Reply