external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Show a function in written form.
Show-FunctionItem [-Name] <String> [<CommonParameters>]
This command will display a loaded function as it might look in a code editor. You could use this command to export a loaded function to a file.
PS C:\> Show-FunctionItem prompt
Function Prompt {
"PS $($executionContext.SessionState.Path.CurrentLocation)$('\>' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
} #close prompt
PS C:\> Show-FunctionItem Copy-Zip | Out-File c:\Scripts\copy-zip.ps1
Here's how you can save or export a function you might have created on-the-fly to a file.
What is the name of your function?
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/