The Update-ScriptFileInfo cmdlet updates a script's property values. For example, the values for
version, author, or description.
This is a proxy cmdlet for the Update-PSScriptFileInfo cmdlet in the
Microsoft.PowerShell.PSResourceGet. For more information, see
Update-PSScriptFileInfo.
示例
Example 1: Update the version of a script file
In this example, an existing script file is updated with new property values.
Splatting is used to pass parameters to the Update-ScriptFileInfo cmdlet. For more information,
see about_Splatting.
$Parms = @{
Path = "C:\Test\Temp-Scriptfile.ps1"
Version = "2.0"
Author = "bob@contoso.com"
CompanyName = "Contoso"
Description = "This is the updated description"
}
Update-ScriptFileInfo @Parms -PassThru
<#PSScriptInfo
.VERSION 2.0
.GUID 4609f00c-e850-4d3f-9c69-3741e56e4133
.AUTHOR bob@contoso.com
.COMPANYNAME Contoso
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
<#
.DESCRIPTION
This is the updated description
#>
Param()
$Parms stores the parameter values for Path, Version, Author, CompanyName, and
Description. Update-ScriptFileInfo gets the parameter values from @Parms and updates the
script. The PassThru parameter displays the script's contents in the PowerShell console.
Specifies a path to one or more locations. The LiteralPath parameter's value is used exactly as
it's entered. No characters are interpreted as wildcards. If the path includes escape characters,
enclose them in single quotation marks. Single quotation marks tell PowerShell not to interpret any
characters as escape sequences.
The proxy cmdlet maps this parameter to the Path parameter of Update-PSScriptFileInfo.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.