none
SymLinks in PowerShell RRS feed

  • Question

  • Hi All,

    I currently use the below batch script to make symlinks for every file/folder within a directory.  Is there a way to accomplish this in Powershell?

    SET target="C:\Backups\Folder1"
    SET filter=*

    forfiles /s /m %filter% /c "cmd /c IF @isdir==TRUE mklink /D %target%\@relpath %cd%\@relpath"

    • Moved by Bill_Stewart Wednesday, September 4, 2019 6:14 PM This is not "teach me basics" forum
    Friday, March 1, 2019 1:21 PM

All replies

  • Hi All,

    I currently use the below batch script to make symlinks for every file/folder within a directory.  Is there a way to accomplish this in Powershell?

    Of course thre is ...  you can use mklink in Powershell as well. Or you use the cmdlet New-Item with the parameter -ItemTypeSymbolicLink, Junction or HardLink. You should read the complete help including the examples to learn how to use it.

    When you post code please format it as code using the code posting tool provided on the edit bar of the post editor. Thanks.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''



    • Edited by BOfH-666 Friday, March 1, 2019 3:41 PM
    Friday, March 1, 2019 3:40 PM