PoshTip #56 – The term ‘psEdit’ is not recognized as the name of a cmdlet

You can quickly open file(s) in a new tab in Powershell ISE with psEdit. PowerShell ISE has this useful psEdit command that allows you to open and edit a PowerShell Script. If you type psEdit in your PowerShell console, you will get the following error message:

psEdit only works in the ISE because it is an editing application. Powershell CLI/Console is not designed for editing:

psedit : The term ‘psedit’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ psedit
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (psedit:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

The psEdit function is available only in the PowerShell ISE. Let’s confirm by running the following command in your ISE:

PS > gcm psedit | fl *

Name        : psEdit
CommandType : Function
Definition  : param([Parameter(Mandatory=$true)]$filenames)
              
                  foreach ($filename in $filenames)
                  {
                      dir $filename | where {!$_.PSIsContainer} | %{
                          $psISE.CurrentPowerShellTab.Files.Add($_.FullName) > $null
                      }
                  }

psEdit is a function and not a compiled cmdlet.

With psEdit, you can open multiples files with only one command:

PS > psedit -filenames C:\Temp\file1.csv, C:\Temp\file2.csv

 

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.