How do you follow a hard link (reparse point?) to a file? Piping to format-list doesn't show the target. At least in powershell 7, you get a little ascii arrow. That folder is in the $env:path. MicrosoftEdge.exe is linked in the same folder, if you don't have Windows Terminal. I'm in win10 20h2.
get-item $env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe
Directory: C:\Users\admin\AppData\Local\Microsoft\WindowsApps
Mode LastWriteTime Length Name
---- ------------- ------ ----
la--- 3/31/2022 1:27 PM 0 wt.exe ->
get-item $env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe | % attributes
Archive, ReparsePoint
This just gives a lot of binary:
fsutil reparsepoint query $env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe
Reparse Tag Value : 0x8000001b
Tag value: Microsoft
Reparse Data Length: 0x192
Reparse Data:
0000: 03 00 00 00 4d 00 69 00 63 00 72 00 6f 00 73 00 ....M.i.c.r.o.s.
0010: 6f 00 66 00 74 00 2e 00 57 00 69 00 6e 00 64 00 o.f.t...W.i.n.d.
0020: 6f 00 77 00 73 00 54 00 65 00 72 00 6d 00 69 00 o.w.s.T.e.r.m.i.
0030: 6e 00 61 00 6c 00 50 00 72 00 65 00 76 00 69 00 n.a.l.P.r.e.v.i.
0040: 65 00 77 00 5f 00 38 00 77 00 65 00 6b 00 79 00 e.w._.8.w.e.k.y.
0050: 62 00 33 00 64 00 38 00 62 00 62 00 77 00 65 00 b.3.d.8.b.b.w.e.
0060: 00 00 4d 00 69 00 63 00 72 00 6f 00 73 00 6f 00 ..M.i.c.r.o.s.o.
0070: 66 00 74 00 2e 00 57 00 69 00 6e 00 64 00 6f 00 f.t...W.i.n.d.o.
0080: 77 00 73 00 54 00 65 00 72 00 6d 00 69 00 6e 00 w.s.T.e.r.m.i.n.
0090: 61 00 6c 00 50 00 72 00 65 00 76 00 69 00 65 00 a.l.P.r.e.v.i.e.
00a0: 77 00 5f 00 38 00 77 00 65 00 6b 00 79 00 62 00 w._.8.w.e.k.y.b.
00b0: 33 00 64 00 38 00 62 00 62 00 77 00 65 00 21 00 3.d.8.b.b.w.e.!.
00c0: 41 00 70 00 70 00 00 00 43 00 3a 00 5c 00 50 00 A.p.p...C.:.\.P.
00d0: 72 00 6f 00 67 00 72 00 61 00 6d 00 20 00 46 00 r.o.g.r.a.m. .F.
00e0: 69 00 6c 00 65 00 73 00 5c 00 57 00 69 00 6e 00 i.l.e.s.\.W.i.n.
00f0: 64 00 6f 00 77 00 73 00 41 00 70 00 70 00 73 00 d.o.w.s.A.p.p.s.
0100: 5c 00 4d 00 69 00 63 00 72 00 6f 00 73 00 6f 00 \.M.i.c.r.o.s.o.
0110: 66 00 74 00 2e 00 57 00 69 00 6e 00 64 00 6f 00 f.t...W.i.n.d.o.
0120: 77 00 73 00 54 00 65 00 72 00 6d 00 69 00 6e 00 w.s.T.e.r.m.i.n.
0130: 61 00 6c 00 50 00 72 00 65 00 76 00 69 00 65 00 a.l.P.r.e.v.i.e.
0140: 77 00 5f 00 31 00 2e 00 38 00 2e 00 31 00 30 00 w._.1...8...1.0.
0150: 39 00 32 00 2e 00 30 00 5f 00 78 00 36 00 34 00 9.2...0._.x.6.4.
0160: 5f 00 5f 00 38 00 77 00 65 00 6b 00 79 00 62 00 _._.8.w.e.k.y.b.
0170: 33 00 64 00 38 00 62 00 62 00 77 00 65 00 5c 00 3.d.8.b.b.w.e.\.
0180: 77 00 74 00 2e 00 65 00 78 00 65 00 00 00 30 00 w.t...e.x.e...0.
0190: 00 00 ..
Even Sysinternals Findlinks doesn't work:
findlinks $env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe
Findlinks v1.1 - Locate file hard links
Copyright (C) 2011-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
Error opening c:\users\js2010\appdata\local\microsoft\windowsapps\wt.exe:
The file cannot be accessed by the system.
Simply parse the
fsutil.exe
output (see theParseFsutil
function below). Tested under Microsoft Windows[Version 10.0.19043.1620]
:pwsh.exe
(PSVersion7.1.5
),powershell.exe
/powershell_ise.exe
(PSVersion5.1.19041.1620
),Please note ugly hard-coded index (
$fsuColon
) and width ($fsuWidth
) infsutil
output, and non-optimizedParseFsutil
function…Output (truncated):
pwsh -nopro -file D:\PShell\SO\71697488.ps1 -Verbose
Output (truncated):
powershell -nopro -file D:\PShell\SO\71697488.ps1 -Verbose
Output:
powershell -nopro -file D:\PShell\SO\71697488.ps1 -Path D:\PShell\SO\71697488.ps1 -Verbose
Raw output from the
ParseFsutil
function: