ConvertTo-Sfx

Synopsis

Converts a .Zip archive to a self-extracting archive.

Syntax

ConvertTo-Sfx -Path <PSObject> [[-SaveOptions] <SelfExtractorSaveOptions>] [[-ReadOptions] <ReadOptions>] [[-Comment] <String>] [-Passthru] [<CommonParameters>]

ConvertTo-Sfx -LiteralPath <PSObject> [[-SaveOptions] <SelfExtractorSaveOptions>] [[-ReadOptions] <ReadOptions>] [[-Comment] <String>] [-Passthru] [<CommonParameters>]

Description

.Zip archive conversion to a self-extracting archive includes uncompress treatment in the resulting file. You can specify a command line to be run once the uncompression process has finished.

Parameters

-Path <PSObject>

.Zip file name to convert.

Required? True
Position? named
Default value  
Accept pipeline input? true (ByValue)
Accept wildcard characters? False

-SaveOptions <SelfExtractorSaveOptions>

Generation options created through the 'New-ZipSfxOptions' function.

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

-ReadOptions <ReadOptions>

Options applied when reading archive (.zip) that is converted to a self-extracting archive (.exe). Created options from the New-ReadOptions function.

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

-Comment <String>

Archive's comment.

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

-Passthru <SwitchParameter>

Returns the generated file in object form and not just his name. Archive object is not locked so be attentive to your usage scenarios of this object.

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

-LiteralPath <PSObject>

.Zip file name to convert. Generic characters won't be interpreted.

Required? True
Position? named
Default value  
Accept pipeline input? true (ByValue)
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

System.String, System.IO.FileInfo

Outputs

None

Notes

The dotnet framework 2.0 is needed on the computer that uncompresses the self-exctracting archive. The folder specified by the 'ExtractDirectory' parameter (cf. New-ZipSfxOptions) can contains system variables references. For example %UserProfile%. Those will be replaced while running the self-extracting archive. Be carrefull : it is not possible to save a splitted archive into a self-extracting archive.

Examples

EXAMPLE 1

PS C:\> $ZipFileName="C:\Temp\MySetup.zip" 
$ReadOptions = New-Object Ionic.Zip.ReadOptions -Property @{ 
                StatusMessageWriter = [System.Console]::Out
              } 
$Save=@{
    ExeOnUnpack="Powershell -noprofile -File .\MySetup.ps1";  
    Description="Setup for the my module"; 
    NameOfProduct="MyProjectName";
    VersionOfProduct="1.0.0";
    Copyright='This module is free for non-commercial purposes.'
}
$SaveOptions=New-ZipSfxOptions @Save
ConvertTo-Sfx $ZipFileName -Save $SaveOptions -Read $ReadOptions

Using New-ZipSfxOptions function, those instructions build the settings to be used during the construction of the self-extracting archive. Then it converts a .Zip file archive into a self-extracting archive (.exe). The $ReadOptions variable is used to display the progress of the process in the console.

Related links

Unknown https://psionic.codeplex.com/wikipage?title=ConvertTo-Sfx-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:41 AM by LaurentDardenne, version 2

Comments

No comments yet.