Functions/Scripting/Edit-Command.ps1

Function Edit-Command
    {
    [CmdletBinding()]
    Param
        (
        # Name of Command to Edit
        [Parameter(Mandatory=$true)]
        [String]
        $Command
        )

    Process
        {
        $GetCommand = Get-Command $Command
        if ($GetCommand)
            {
            $ScriptFile = Get-ChildItem -Path $GetCommand.Module.ModuleBase -Recurse | where name -eq "$Command.ps1"
            if ($ScriptFile) {psedit $ScriptFile.FullName}
            }
        }
    }