forked from sergiocabral/Sample.Batch.AppVersionSelect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-select.bat
37 lines (34 loc) · 996 Bytes
/
app-select.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
@echo off
set SELECTOR_PATH=%~dp0
set SELECTOR_VERSION_NAME=%1
set SELECTOR_VERSION_PATH=%SELECTOR_PATH%\%SELECTOR_VERSION_NAME%
set SELECTOR_LINK_NAME=current
set SELECTOR_LINK_PATH=%SELECTOR_PATH%\%SELECTOR_LINK_NAME%
set SELECTOR_TITLE=[VERSIONS]
if defined SELECTOR_VERSION_NAME (
if exist %SELECTOR_VERSION_PATH% (
echo Version setted: %SELECTOR_VERSION_NAME%
if exist %SELECTOR_LINK_PATH% (
rmdir %SELECTOR_LINK_PATH%
)
mklink /d %SELECTOR_LINK_PATH% %SELECTOR_VERSION_PATH% > NUL
) else (
echo Invalid version: %SELECTOR_VERSION_NAME%
)
) else (
if exist %SELECTOR_LINK_PATH% (
move %SELECTOR_LINK_PATH% %SELECTOR_PATH%\%SELECTOR_TITLE% > NUL
) else (
echo %SELECTOR_TITLE%
)
dir /B/AD/ON %SELECTOR_PATH%
if exist %SELECTOR_PATH%\%SELECTOR_TITLE% (
move %SELECTOR_PATH%\%SELECTOR_TITLE% %SELECTOR_LINK_PATH% > NUL
)
)
set SELECTOR_PATH=
set SELECTOR_VERSION_NAME=
set SELECTOR_VERSION_PATH=
set SELECTOR_LINK_NAME=
set SELECTOR_LINK_PATH=
set SELECTOR_TITLE=