Last active
May 3, 2016 22:39
-
-
Save B17C0D3/356206dd1371df35f6399aa1d6fde745 to your computer and use it in GitHub Desktop.
Mova and Link Folders in Windows
This file contains 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 | |
SET _Quelle="D:\Games\foo" | |
SET _Ziel="C:\Anwendungen\foo" | |
REM Beim ersten Aufruf sollte das Ziel nicht exestieren. | |
IF EXIST %_Ziel% GOTO MoveBack | |
REM Quelle wird verschoben und anstelle ein Link gesetzt | |
XCOPY /E /H /I /K /O /Q /Y %_Quelle% %_Ziel% | |
ECHO Sollte ein Fehler vorliegen, jetzt mit STRG + C beenden! | |
PAUSE | |
RMDIR /S /Q %_Quelle% | |
MKLINK /J %_Quelle% %_Ziel% | |
PAUSE | |
EXIT | |
REM Link wird gelöscht und der Ordner zurück verschoben. | |
:MoveBack | |
RMDIR %_Quelle% | |
XCOPY /E /H /I /K /O /Q /Y %_Ziel% %_Quelle% | |
ECHO Sollte ein Fehler vorliegen, jetzt mit STRG + C beenden! | |
PAUSE | |
RMDIR /S /Q %_Ziel% | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment