You can insert arbitrary PowerShell script code into a double-quoted string using a subexpression, such as $ ():
"C:\temp\mybackup $(get-date -f yyyy-MM-dd).zip"
And if you get the path from another place - already as a line:
$dirName = [io.path]::GetDirectoryName($path) $filename = [io.path]::GetFileNameWithoutExtension($path) $ext = [io.path]::GetExtension($path) $newPath = "$dirName\$filename $(get-date -f yyyy-MM-dd)$ext"
And if the path comes from Get-ChildItem output:
Get-ChildItem *.zip | Foreach { "$($_.DirectoryName)\$($_.BaseName) $(get-date -f yyyy-MM-dd)$($_.extension)"}
Keith Hill Dec 23 '09 at 18:03 2009-12-23 18:03
source share