Skip to main content

Remove-File

SYNOPSISโ€‹

Removes one or more items from a given path on the filesystem.

SYNTAXโ€‹

Pathโ€‹

Remove-File -Path <String[]> [-Recurse] [-ContinueOnError <Boolean>] [<CommonParameters>]

LiteralPathโ€‹

Remove-File -LiteralPath <String[]> [-Recurse] [-ContinueOnError <Boolean>] [<CommonParameters>]

DESCRIPTIONโ€‹

Removes one or more items from a given path on the filesystem.

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Remove-File -Path 'C:\Windows\Downloaded Program Files\Temp.inf'

EXAMPLE 2โ€‹

Remove-File -LiteralPath 'C:\Windows\Downloaded Program Files' -Recurse

PARAMETERSโ€‹

-Pathโ€‹

Specifies the path on the filesystem to be resolved. The value of Path will accept wildcards. Will accept an array of values.

Type: String[]
Parameter Sets: Path
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LiteralPathโ€‹

Specifies the path on the filesystem to be resolved. The value of LiteralPath is used exactly as it is typed; no characters are interpreted as wildcards. Will accept an array of values.

Type: String[]
Parameter Sets: LiteralPath
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Recurseโ€‹

Deletes the files in the specified location(s) and in all child items of the location(s).

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ContinueOnErrorโ€‹

Continue if an error is encountered. Default is: $true.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
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โ€‹

https://psappdeploytoolkit.com