Here's a powershell function that'll do what you're asking... It does absolutely no sanity checking, so caveat emptor...
function Copy-FileWithTimestamp {
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0)][string]$Path,
[Parameter(Mandatory=$true,Position=1)][string]$Destination
)
$origLastWriteTime = ( Get-ChildItem $Path ).LastWriteTime
Copy-Item -Path $Path -Destination $Destination
(Get-ChildItem $Destination).LastWriteTime = $origLastWriteTime
}
Once you've run loaded that, you can do something like:
Copy-FileWithTimestamp foo bar
(you can also name it something shorter, but with tab completion, not that big of a deal...)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…