1 @echo off 2 :: %1 is source 3 :: %2 is output 4 5 :: Delete it if it existed 6 if exist "%2" del "%2" 7 8 :: Try to create a hardlink (argument are in reverse order). Hide errors if they occur, we have a fallback. 9 fsutil hardlink create "%2" "%1" > nul 10 11 :: If it failed, copy it instead. Don't hide errors if it fails. 12 if errorlevel 1 copy "%1" "%2" 13