0612デフォルトの名無しさん
2020/10/01(木) 21:26:37.01ID:tnCBqate$origCurDir = [System.Environment]::CurrentDirectory
New-Item -ItemType Directory -Path linktest
Push-Location linktest
New-Item -ItemType Directory -Path dir
Push-Location dir # linktest/dir
New-Item -ItemType Directory -Path subdir
Set-Content -Path file -Value "hello"
New-Item -ItemType HardLink -Path hardlink_1 -Value file
New-Item -ItemType SymbolicLink -Path symlink_1 -Value subdir
Pop-Location # linktest
New-Item -ItemType HardLink -Path dir/hardlink_2 -Value dir/file
New-Item -ItemType SymbolicLink -Path dir/symlink_2 -Value subdir
Push-Location dir # linktest/dir
[System.Environment]::CurrentDirectory = $PWD
New-Item -ItemType HardLink -Path hardlink_3 -Value file
New-Item -ItemType SymbolicLink -Path symlink_3 -Value subdir
Pop-Location # linktest
[System.Environment]::CurrentDirectory = $PWD
New-Item -ItemType HardLink -Path dir/hardlink_4 -Value dir/file
New-Item -ItemType SymbolicLink -Path dir/symlink_4 -Value subdir
Pop-Location
[System.Environment]::CurrentDirectory = $origCurDir
Get-ChildItem -Path linktest/dir | Sort-Object -Property CreationTime | Format-Table Attributes,LinkType,Target,Length,Name