Skip to content

Clear-WindowsTemp

SYNOPSIS

A script to clean out old Windows Temp files.

SYNTAX

Clear-WindowsTemp [[-Days] <Int16>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

This script will clean out Windows Temp files older than x days.

EXAMPLES

EXAMPLE 1

Clear-WindowsTemp -Days 60

Removes all Windows Temp files that are older than 60 days.

PARAMETERS

-Days

The number of days to keep temp files. The default is 30 days.

Type: Int16
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: 30
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

CommonParameters

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

INPUTS

OUTPUTS

NOTES