Main | Contact | Blog | Documentation

PowerShell Framework

The project dedicated to empowering your PowerShell scripting.

New-PSFTempFile

SYNOPSIS

Creates a temporary file.

SYNTAX

New-PSFTempFile [-Name] <String> [[-FileName] <String>] [[-Extension] <String>]
 [[-Timeout] <DateTimeParameter>] [[-ModuleName] <String>] [<CommonParameters>]

DESCRIPTION

Creates a temporary file.

EXAMPLES

EXAMPLE 1

New-PSFTempFile -Name 'report' -Extension csv

Creates a temporary file with the csv extension.

PARAMETERS

-Name

Name of the temporary file item. Note: The actual filename will be autogenerated and ignore this value.

Type: String
Parameter Sets: (All)
Aliases:

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

-FileName

Specify the exact name of the temporary file to generate. By default, a generic name is autogenerated instead.

Type: String
Parameter Sets: (All)
Aliases:

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

-Extension

The extension the temporary file is supposed to have. Defaults to “tmp”

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: Tmp
Accept pipeline input: False
Accept wildcard characters: False

-Timeout

How long into the future this item is valid. Expired temporary items can be conveniently cleaned up using Remove-PSFTempItem.

Type: DateTimeParameter
Parameter Sets: (All)
Aliases:

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

-ModuleName

Name of the module the temp item belongs to. If called from within a module, this value will be detected automatically and needs not be specified.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: [PSFramework.Utility.UtilityHost]::GetCallerInfo(1).CallerModule
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

OUTPUTS

NOTES