-
Notifications
You must be signed in to change notification settings - Fork 8
Add PSProfileInitScript
Adds script contents to your PSProfile configuration directly. Contents will be invoked during PSProfile import. Useful for scripts that you want to include directly on your configuration for portability instead of calling as an external script via $PSProfile.ScriptPaths.
Add-PSProfileInitScript [-Name] <String> [-Content] <String[]> [-State <String>] [-Force] [-Save]
[<CommonParameters>]
Add-PSProfileInitScript [-Name] <String> [-ScriptBlock] <ScriptBlock> [-State <String>] [-Force] [-Save]
[<CommonParameters>]
Add-PSProfileInitScript -Path <String[]> [-State <String>] [-RemoveDuplicateScriptPaths] [-Force] [-Save]
[<CommonParameters>]
Adds script contents to your PSProfile configuration directly. Contents will be invoked during PSProfile import. Useful for scripts that you want to include directly on your configuration for portability instead of calling as an external script via $PSProfile.ScriptPaths.
Get-PSProfileScriptPath | Add-PSProfileInitScript
The friendly name to reference the script block by.
Type: String
Parameter Sets: Content, ScriptBlock
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The content of the script as a string, i.e. if using `Get-Content` against another file to pass as the value here.
Type: String[]
Parameter Sets: Content
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The content of the script as a scriptblock. Useful if you are adding as script manually
Type: ScriptBlock
Parameter Sets: ScriptBlock
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The path to an external PS1 file to import the contents to your $PSProfile.InitScripts directly. When using Path, the file's BaseName becomes the Name value.
Type: String[]
Parameter Sets: Path
Aliases: FullName
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Whether the InitScript should be Enabled or Disabled. Defaults to Enabled.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Enabled
Accept pipeline input: False
Accept wildcard characters: False
If a specified Path is also in $PSProfile.ScriptPaths, remove it from there to prevent duplicate scripts from being invoked during PSProfile import.
Type: SwitchParameter
Parameter Sets: Path
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
If the InitScript name already exists in $PSProfile.InitScripts, use -Force to overwrite the existing value.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
If $true, saves the updated PSProfile after updating.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
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.
- Command Aliases
- Configuration
- Helpers
- Init Scripts
- Meta
- Modules to Import
- Modules to Install
- Path Aliases
- Plugin Paths
- Plugins
- Power Tools
- Project Paths
- Prompts
- Script Paths
- Secrets
- Symbolic Links
- Variables
- Export-PSProfileConfiguration
- Import-PSProfile
- Import-PSProfileConfiguration
- Save-PSProfile
- Start-PSProfileConfigurationHelper
- Update-PSProfileConfig
- Update-PSProfileRefreshFrequency
- Update-PSProfileSetting
- Add-PSProfileToProfile
- Copy-Parameters
- Get-LastCommandDuration
- Get-PathAlias
- Get-PSProfileArguments
- Get-PSVersion
- Test-IfGit
- Write-PSProfileLog
- Add-PSProfileInitScript
- Disable-PSProfileInitScript
- Edit-PSProfileInitScript
- Enable-PSProfileInitScript
- Get-PSProfileInitScript
- Remove-PSProfileInitScript
- Confirm-ScriptIsValid
- Enter-CleanEnvironment
- Format-Syntax
- Get-Definition
- Get-Gist
- Get-LongPath
- Install-LatestModule
- Open-Code
- Open-Item
- Pop-Path
- Push-Path
- Start-BuildScript
- Test-RegEx
- Add-PSProfilePrompt
- Edit-PSProfilePrompt
- Get-PSProfilePrompt
- Remove-PSProfilePrompt
- Switch-PSProfilePrompt