powershell to resolve junction target path

后端 未结 7 1110
闹比i
闹比i 2020-12-09 15:32

In PowerShell, I need resolve the target path of a junction (symlink).

for example, say I have a junction c:\\someJunction whose target is c:\\te

7条回答
  •  爱一瞬间的悲伤
    2020-12-09 16:02

    New-Item, Remove-Item, and Get-ChildItem have been enhanced to support creating and managing symbolic links. The -ItemType parameter for New-Item accepts a new value, SymbolicLink. Now you can create symbolic links in a single line by running the New-Item cmdlet.

    What's New in Windows PowerShell v5

    I've checked the symlink support on the my Windows 7 machine, it's works fine.

    PS> New-Item -Type SymbolicLink -Target C:\ -Name TestSymlink
    
    
        Directory: C:\Users\skokhanovskiy\Desktop
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d----l       06.09.2016     18:27                TestSymlink
    

    Get target of the symbolic link as easy as to create it.

    > Get-Item .\TestSymlink | Select-Object -ExpandProperty Target
    C:\
    

提交回复
热议问题