New-ZipFile
SYNOPSISโ
Create a new zip archive or add content to an existing archive.
SYNTAXโ
CreateFromDirectory (Default)โ
New-ZipFile [-DestinationArchiveDirectoryPath] <String> [-DestinationArchiveFileName] <String>
[-SourceDirectoryPath] <String[]> [-RemoveSourceAfterArchiving] [-OverWriteArchive]
[[-ContinueOnError] <Boolean>] [<CommonParameters>]
CreateFromFileโ
New-ZipFile [-DestinationArchiveDirectoryPath] <String> [-DestinationArchiveFileName] <String>
[-SourceFilePath] <String[]> [-RemoveSourceAfterArchiving] [-OverWriteArchive] [[-ContinueOnError] <Boolean>]
[<CommonParameters>]
DESCRIPTIONโ
Create a new zip archive or add content to an existing archive by using the Shell object .CopyHere method.
EXAMPLESโ
EXAMPLE 1โ
New-ZipFile -DestinationArchiveDirectoryPath 'E:\Testing' -DestinationArchiveFileName 'TestingLogs.zip' -SourceDirectory 'E:\Testing\Logs'
PARAMETERSโ
-DestinationArchiveDirectoryPathโ
The path to the directory path where the zip archive will be saved.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-DestinationArchiveFileNameโ
The name of the zip archive.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SourceDirectoryPathโ
The path to the directory to be archived, specified as absolute paths.
Type: String[]
Parameter Sets: CreateFromDirectory
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SourceFilePathโ
The path to the file to be archived, specified as absolute paths.
Type: String[]
Parameter Sets: CreateFromFile
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RemoveSourceAfterArchivingโ
Remove the source path after successfully archiving the content. Default is: $false.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-OverWriteArchiveโ
Overwrite the destination archive path if it already exists. Default is: $false.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ContinueOnErrorโ
Continue if an error is encountered. Default: $true.
Type: Boolean
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: True
Accept pipeline input: False
Accept wildcard characters: False
CommonParametersโ
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTSโ
Noneโ
You cannot pipe objects to this function.โ
OUTPUTSโ
Noneโ
This function does not generate any output.โ
NOTESโ
This is an internal script function and should typically not be called directly.