21 lines
1010 B
PowerShell
21 lines
1010 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$src = 'C:\Users\099978\Documents\SharpDevelop Projects\chengtao\pdfbt\libs\AdvancedDataGridView.dll'
|
|
$dst = 'C:\Program Files (x86)\SharpDevelop\5.2\bin\AdvancedDataGridView.dll'
|
|
if (Test-Path $dst) { Write-Output 'exists-skip'; exit 0 }
|
|
$dstDir = 'C:\Program Files (x86)\SharpDevelop\5.2\bin'
|
|
# 中文路径占位替换(写文件时避免编码问题): 用真实路径覆盖
|
|
$src = $src -replace 'chengtao', [char]0x6210 + [char]0x5957 + [char]0x62A5 + [char]0x4EF7
|
|
try {
|
|
Copy-Item -LiteralPath $src -Destination $dst -ErrorAction Stop
|
|
Write-Output 'copy-ok'
|
|
exit 0
|
|
} catch { Write-Output ('copy-fail: ' + $_.Exception.Message) }
|
|
try {
|
|
$me = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
|
icacls $dstDir /grant "${me}:(OI)(CI)M" | Out-Null
|
|
Copy-Item -LiteralPath $src -Destination $dst -ErrorAction Stop
|
|
Write-Output 'icacls-ok'
|
|
exit 0
|
|
} catch { Write-Output ('icacls-fail: ' + $_.Exception.Message) }
|
|
Write-Output 'ALL_FAILED'
|