Skip to content

Commit ece867a

Browse files
committed
add create_hardlink
1 parent 4726001 commit ece867a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

os/win.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
function create_hardlink {
2+
param(
3+
$target_path,
4+
$source_path
5+
)
6+
if (Test-Path $target_path) {
7+
Remove-Item $target_path -Force
8+
}
9+
New-Item -ItemType HardLink -Path $target_path -Value $source_path -Force | Out-Null
10+
$item = Get-Item $target_path
11+
if ($item.LinkType -ne "HardLink") {
12+
Write-Error "File at $target_path is not a hardlink"
13+
}
14+
}
15+
116
# -- os_upgrade --
217

318
function win_os_upgrade() {

0 commit comments

Comments
 (0)