|
Re: Add Date and time to filename The more I play with the format operator ( -f ) the more I love it. You can generate your filename like this:
PS> $date = Get-Date
PS> $filename
PS> $filename = "FileName{0}{1:d2}{2:d2}-{3:d2}{4:d2}" -f $date.year,$date.month,$date.day,$date.hour,$date.minute
PS> $FileName
FileName20070511-1035
"get-help about_operators" has a little bit on the subject.
^_^ ~Clint
$filename = "FileName{0}{1:d2}{2:d2}-{3:d2}{4:d2}" -f $date.year,$date.month,$date.day,$date.hour,$date.minute
"Jimbo" <Jimbo@discussions.microsoft.com> wrote in message news:333EB1A8-E981-4882-BA24-35D13000DA4E@microsoft.com...
> How do I add the date and time onto a filename I am generating in format
> somefilename20070511-0911 ?
>
> Thanks |