Function to invoke PowerShell ISE from shell

Another little function to add to your PowerShell profile.

If you’re in the PowerShell Integrated Scripting Environment you can use the command

psedit <filename>

to open the file in the ISE editor – and it doesn’t just have to be a .ps1 file, it’ll open anything.

But if you have a regular PowerShell prompt open, psedit doesn’t work. Until now!

function psedit ($Filename){
    & "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell_ise.exe" $Filename
}

It’ll also work if you just type psedit with no filename, and will open a new tab in the editor.

Advertisements
This entry was posted in PowerShell and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s