external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Create a random file name.
New-RandomFileName [-Extension <String>] [<CommonParameters>]
New-RandomFileName [-Extension <String>] [-UseTempFolder] [<CommonParameters>]
New-RandomFileName [-Extension <String>] [-UseHomeFolder] [<CommonParameters>]
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.
PS C:\> New-RandomFileName
fykxecvh.ipw
PS C:\> New-RandomFileName -extension dat
emevgq3r.dat
Specify a file extension.
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.
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.
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
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
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
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).
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/