-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsymlinks.bat
54 lines (41 loc) · 1.08 KB
/
symlinks.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@echo off
rem mklink requires Administrator privileges, but then cmd starts in C:\Windows\system32
set SICP_ROOT=F:\Users\Jonathan\Documents\Qt\Projects-vc2008\sicp
set SICP_ROOT_HOME=D:\Users\Jonathan\Documents\Qt\projs-2008\sicp
if exist "%SICP_ROOT%" (
cd /d "%SICP_ROOT%"
) else if exist "%SICP_ROOT_HOME%" (
cd /d "%SICP_ROOT_HOME%"
) else (
echo SICP directory not found
pause
exit /b
)
set TARGETS=symlink-targets.txt
call :checkExists "%TARGETS%"
setlocal enabledelayedexpansion
for /f "tokens=1-3" %%i in (%TARGETS%) do (
pushd %%i
set TARGET_FILE=%%k
rem http://www.computing.net/answers/programming/batch-file-replace-forward-slash/15589.html
call :makeSymlink %%j !TARGET_FILE:/=\!
popd
)
pause
exit /b
:makeSymlink
call :checkExists %2
if not exist %1 (
mklink %1 %2
) else (
rem echo Skipping %CD%\%1 - already exists!
)
rem echo "Want to create link %1 ==> %2"
exit /b
:checkExists
if not exist %1 (
echo Error - file not found: %1
pause
exit
)
exit /b