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 9 :: they occur, we have a fallback. 10 mklink /h "%2" "%1" > nul 11 12 :: If it failed, copy it instead. Don't hide errors if it fails. 13 if errorlevel 1 copy "%1" "%2" 14