Last active
February 11, 2024 16:40
-
-
Save 709924470/a9a4c7c8a6bdd10ea2406c070dfec652 to your computer and use it in GitHub Desktop.
Windows quick hardlink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
rem Put this file under your destination folder | |
rem and drag your file(s) onto this bat for hardlinking. | |
rem Remember to check the path while prompt. | |
rem This only works after Windwos 7(incl.) | |
rem i.e. windows versions with fsutil included. | |
SET DEST=%~dp0 | |
echo Linking files to %DEST% | |
:PROMPT | |
SET /P CONFIRM=Are you sure (Y/[N])? | |
IF /I "%CONFIRM%" NEQ "Y" GOTO :END | |
:START | |
if "%~1"=="" goto :END | |
echo Linking "%~f1" (%~z1 bytes) | |
echo To "%DEST%%~nx1" | |
fsutil hardlink create "%DEST%%~nx1" "%~f1" | |
shift | |
goto :START | |
:END | |
echo Finished | |
PAUSE | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment