Starting Windows 7, when I copied the file to an external drive, during a regular file backup , I use Powershell v2 (run from a batch file) - create all the timestamps of the source file in the copy file.
The following code works in most cases, but not always: -
SET file=%1
SET dest=E:\
COPY /V /Y %file% "%dest%"
SetLocal EnableDelayedExpansion
FOR /F "usebackq delims==" %%A IN ('%file%') DO (
SET fpath=%%~dpA
SET fname=%%~nxA
)
PowerShell.exe (Get-Item \"%dest%\%fname%\").CreationTime=$(Get-Item \"%fpath%%fname%\" ^| Select-Object -ExpandProperty CreationTime ^| Get-Date -f \"MM-dd-yyyy HH:mm:ss\")
The above code copies the file and then sets the date / time the copy (destination) file was created to the file of the source file when I drag the source file into my batch file.
, . "", () [...], " CreationTime" ". "".
, &.
Powershell, , . , - , , Powershell.
, . .ps1, , , .ps1.
.
. , , mklement0. , Powershell -
PowerShell.exe (Get-Item -LiteralPath \"%dest%\%fname%\").CreationTime=$(Get-Item -LiteralPath \"%fpath%%fname%\" ^| Select-Object -ExpandProperty CreationTime ^| Get-Date -f \"MM-dd-yyyy HH:mm:ss\")
, ( Windows 7):
. .
- : , : ; ,
powershell.exe -command echo \"a b\" a b.
"..." -
powershell.exe -command "echo \"a b\"" - cmd.exe , ; ,
powershell.exe -command "echo \"a & b\""
, ( ), . FAT NTFS, .
'( ) Powershell, NTFS, . , , , NTFS.
ROBOCOPY - , ! ( = `^). EVEN, ( ):
ROBOCOPY "%fpath% " "%dest%" "*%name%*%ext%*" /B /COPY:DAT /XJ /SL /R:0 /W:0 /V
. "% fpath%" ESSENTIAL, .
. , , (!).
. FILENAME, .