New-ProgressBarInformations

Synopsis

Creates a statement object of a standard Psionic progress bar.

Syntax

New-ProgressBarInformations [-activityId] <Int32> [-activity] <String> [<CommonParameters>]

Description

This object is used by the 'New-ReadOptions' function.

Parameters

-activityId <Int32>

Indicates an identifier distinguishing each progress bar. Use this parameter when you create several progress bars into only one command. If progress bars have no different identity, there will be superposed instead of being shown one below the other.

Required? True
Position? 0
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-activity <String>

Shows the first text line in the progress bar title. This text describes activity whose progress is reported.

Required? True
Position? 1
Default value  
Accept pipeline input? false
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

None

Outputs

PSCustomObject

Notes

Examples

EXAMPLE 1

PS C:\> $pbi=New-ProgressBarInformations 1 "Read in progress "
$ReadOptions=New-ReadOptions $Encoding $pbi  
$FileName='C:\Temp\Backup.zip'
try {
$ZipFile = [Ionic.Zip.ZipFile]::Read($FileName,$ReadOptions)
} finally {
 $ZipFile.Dispose()
}

This example creates a progress bar used in settings of an archive read options. In this context the names of the files that are read are not accessible, so the progress bar will display only the number of read entries.

EXAMPLE 2

PS C:\> $Files=Dir 'C:\temp\*.zip'
$Count=$Files.Count
$I=0
$Files| 
Foreach -begin {  $id=1 } -process { 
  [int]$PCpercent =(($I / $Count ) * 100)
  $I++
  
  Write-Progress -id $id -Activity "Archive : " -Status "$_" -PercentComplete $PCpercent
  Expand-ZipFile -Path $_ -OutputPath 'C:\Temp\TestZip' -Create -ExtractAction OverwriteSilently -ProgressID 2
}#foreach

This example reads all Zip archives from C:\Temp folder, then extracts them. We directly use the '-ProgressID' parameter of the 'Expand-ZipFile' function which configures internally a progress bar. In this case when reading the catalog, the value of the 'Activity' parameter can not be modified, because it is hard-coded.

Related links

Unknown https://psionic.codeplex.com/wikipage?title=New-ProgressBarInformations-EN

PowerShell Support

  • PowerShell 2.0

Operating System Support

  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows Server 2008 all editions
  • Windows Server 2008 R2 all editions
  • Windows Server 2012 all editions
  • Windows Server 2012 R2 all editions

Last edited May 14, 2014 at 11:44 AM by LaurentDardenne, version 2

Comments

No comments yet.