hytos / ID2.Manager / FileUpdate.ps1 @ d8b09f9f
이력 | 보기 | 이력해설 | 다운로드 (692 Bytes)
1 |
|
---|---|
2 |
$sourceFilePath = $args[0] |
3 |
$targetFilePath = $args[1] |
4 |
|
5 |
$sourceFileVersionInfo = Get-ItemProperty -Path $sourceFilePath -Name VersionInfo |
6 |
$targetFileVersionInfo = Get-ItemProperty -Path $targetFilePath -Name VersionInfo |
7 |
|
8 |
$sourceFileVersion = $sourceFileVersionInfo.VersionInfo.ProductVersion |
9 |
$targetFileVersion = $targetFileVersionInfo.VersionInfo.ProductVersion |
10 |
|
11 |
Write-Output "Source File Version: $sourceFileVersion" |
12 |
Write-Output "target File Version: $targetFileVersion" |
13 |
|
14 |
if ([version]$sourceFileVersion -gt [version]$targetFileVersion) { |
15 |
Copy-Item -Path $sourceFilePath -Destination $targetFilePath -Force |
16 |
Write-Host "File copied." |
17 |
} else { |
18 |
Write-Host "No need to copy." |
19 |
} |