Skip to content

Latest commit

 

History

History
144 lines (96 loc) · 2.73 KB

New-RandomFileName.md

File metadata and controls

144 lines (96 loc) · 2.73 KB
external help file Module Name online version schema
PSScriptTools-help.xml
PSScriptTools
2.0.0

New-RandomFileName

SYNOPSIS

Create a random file name.

SYNTAX

none (Default)

New-RandomFileName [-Extension <String>] [<CommonParameters>]

temp

New-RandomFileName [-Extension <String>] [-UseTempFolder] [<CommonParameters>]

home

New-RandomFileName [-Extension <String>] [-UseHomeFolder] [<CommonParameters>]

DESCRIPTION

Create a new random file name. The default is a completely random name including the extension. But you can also create a filename that includes either the TEMP folder or the user's home folder. In the case of a Windows system, the home folder will be the documents folder.

This command does not create the file, it only generates a name for you to use.

EXAMPLES

EXAMPLE 1

PS C:\> New-RandomFileName
fykxecvh.ipw

EXAMPLE 2

PS C:\> New-RandomFileName -extension dat
emevgq3r.dat

Specify a file extension.

EXAMPLE 3

PS C:\> New-RandomFileName -extension log -UseHomeFolder
C:\Users\Jeff\Documents\kbyw4fda.log

Create a random file name using the user's home folder. In Windows, this will be the Documents folder.

EXAMPLE 4

PS /mnt/c/scripts> new-randomfilename -home -Extension tmp
/home/jhicks/oces0epq.tmp

Create a random file name using the user's home folder on a Linux installation.

PARAMETERS

-Extension

Use a specific extension. Do not include the period.

Type: String
Parameter Sets: (All)
Aliases:

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

-UseHomeFolder

Include the user's HOME folder.

Type: SwitchParameter
Parameter Sets: home
Aliases: home

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

-UseTempFolder

Include the TEMP folder.

Type: SwitchParameter
Parameter Sets: temp
Aliases: temp

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, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

None

OUTPUTS

System.String

NOTES

Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/

RELATED LINKS

New-CustomFileName