|
1 |
| -@REM |
2 |
| -@REM Copyright (c) 2012-2013 Jeremy Long. All rights reserved. |
3 |
| -@REM |
4 |
| -@REM Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
| -@REM you may not use this file except in compliance with the License. |
6 |
| -@REM You may obtain a copy of the License at |
7 |
| -@REM |
8 |
| -@REM http://www.apache.org/licenses/LICENSE-2.0 |
9 |
| -@REM |
10 |
| -@REM Unless required by applicable law or agreed to in writing, software |
11 |
| -@REM distributed under the License is distributed on an "AS IS" BASIS, |
12 |
| -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
| -@REM See the License for the specific language governing permissions and |
14 |
| -@REM limitations under the License. |
15 |
| -@REM ---------------------------------------------------------------------------- |
16 |
| - |
17 |
| -@echo off |
18 |
| - |
19 |
| -set ERROR_CODE=0 |
20 |
| - |
21 |
| -:init |
22 |
| -@REM Decide how to startup depending on the version of windows |
23 |
| - |
24 |
| -@REM -- Win98ME |
25 |
| -if NOT "%OS%"=="Windows_NT" goto Win9xArg |
26 |
| - |
27 |
| -@REM set local scope for the variables with windows NT shell |
28 |
| -if "%OS%"=="Windows_NT" @setlocal |
29 |
| - |
30 |
| -@REM -- 4NT shell |
31 |
| -if "%eval[2+2]" == "4" goto 4NTArgs |
32 |
| - |
33 |
| -@REM -- Regular WinNT shell |
34 |
| -set CMD_LINE_ARGS=%* |
35 |
| -goto WinNTGetScriptDir |
36 |
| - |
37 |
| -@REM The 4NT Shell from jp software |
38 |
| -:4NTArgs |
39 |
| -set CMD_LINE_ARGS=%$ |
40 |
| -goto WinNTGetScriptDir |
41 |
| - |
42 |
| -:Win9xArg |
43 |
| -@REM Slurp the command line arguments. This loop allows for an unlimited number |
44 |
| -@REM of arguments (up to the command line limit, anyway). |
45 |
| -set CMD_LINE_ARGS= |
46 |
| -:Win9xApp |
47 |
| -if %1a==a goto Win9xGetScriptDir |
48 |
| -set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 |
49 |
| -shift |
50 |
| -goto Win9xApp |
51 |
| - |
52 |
| -:Win9xGetScriptDir |
53 |
| -set SAVEDIR=%CD% |
54 |
| -%0\ |
55 |
| -cd %0\..\.. |
56 |
| -set BASEDIR=%CD% |
57 |
| -cd %SAVEDIR% |
58 |
| -set SAVE_DIR= |
59 |
| -goto repoSetup |
60 |
| - |
61 |
| -:WinNTGetScriptDir |
62 |
| -for %%i in ("%~dp0..") do set "BASEDIR=%%~fi" |
63 |
| - |
64 |
| -:repoSetup |
65 |
| -set REPO= |
66 |
| - |
67 |
| - |
68 |
| -if "%JAVACMD%"=="" set JAVACMD=java |
69 |
| - |
70 |
| -if "%REPO%"=="" set REPO=%BASEDIR%\lib |
71 |
| - |
72 |
| -set CLASSPATH="%BASEDIR%"\plugins\*;"%REPO%"\* |
73 |
| - |
74 |
| -set ENDORSED_DIR= |
75 |
| -if NOT "%ENDORSED_DIR%" == "" set CLASSPATH="%BASEDIR%"\%ENDORSED_DIR%\*;%CLASSPATH% |
76 |
| - |
77 |
| -if NOT "%CLASSPATH_PREFIX%" == "" set CLASSPATH=%CLASSPATH_PREFIX%;%CLASSPATH% |
78 |
| - |
79 |
| -@REM Reaching here means variables are defined and arguments have been captured |
80 |
| -:endInit |
81 |
| - |
82 |
| -%JAVACMD% %JAVA_OPTS% -classpath %CLASSPATH% -Dapp.name="dependency-check" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" org.owasp.dependencycheck.App %CMD_LINE_ARGS% |
83 |
| -if %ERRORLEVEL% NEQ 0 goto error |
84 |
| -goto end |
85 |
| - |
86 |
| -:error |
87 |
| -if "%OS%"=="Windows_NT" @endlocal |
88 |
| -set ERROR_CODE=%ERRORLEVEL% |
89 |
| - |
90 |
| -:end |
91 |
| -@REM set local scope for the variables with windows NT shell |
92 |
| -if "%OS%"=="Windows_NT" goto endNT |
93 |
| - |
94 |
| -@REM For old DOS remove the set variables from ENV - we assume they were not set |
95 |
| -@REM before we started - at least we don't leave any baggage around |
96 |
| -set CMD_LINE_ARGS= |
97 |
| -goto postExec |
98 |
| - |
99 |
| -:endNT |
100 |
| -@REM If error code is set to 1 then the endlocal was done already in :error. |
101 |
| -if %ERROR_CODE% EQU 0 @endlocal |
102 |
| - |
103 |
| - |
104 |
| -:postExec |
105 |
| - |
106 |
| -if "%FORCE_EXIT_ON_ERROR%" == "on" ( |
107 |
| - if %ERROR_CODE% NEQ 0 exit %ERROR_CODE% |
108 |
| -) |
109 |
| - |
110 |
| -exit /B %ERROR_CODE% |
| 1 | +@REM |
| 2 | +@REM Copyright (c) 2012-2013 Jeremy Long. All rights reserved. |
| 3 | +@REM |
| 4 | +@REM Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +@REM you may not use this file except in compliance with the License. |
| 6 | +@REM You may obtain a copy of the License at |
| 7 | +@REM |
| 8 | +@REM http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +@REM |
| 10 | +@REM Unless required by applicable law or agreed to in writing, software |
| 11 | +@REM distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +@REM See the License for the specific language governing permissions and |
| 14 | +@REM limitations under the License. |
| 15 | +@REM ---------------------------------------------------------------------------- |
| 16 | + |
| 17 | +@echo off |
| 18 | + |
| 19 | +set ERROR_CODE=0 |
| 20 | + |
| 21 | +:init |
| 22 | +@REM Decide how to startup depending on the version of windows |
| 23 | + |
| 24 | +@REM -- Win98ME |
| 25 | +if NOT "%OS%"=="Windows_NT" goto Win9xArg |
| 26 | + |
| 27 | +@REM set local scope for the variables with windows NT shell |
| 28 | +if "%OS%"=="Windows_NT" @setlocal |
| 29 | + |
| 30 | +@REM -- 4NT shell |
| 31 | +if "%eval[2+2]" == "4" goto 4NTArgs |
| 32 | + |
| 33 | +@REM -- Regular WinNT shell |
| 34 | +set CMD_LINE_ARGS=%* |
| 35 | +goto WinNTGetScriptDir |
| 36 | + |
| 37 | +@REM The 4NT Shell from jp software |
| 38 | +:4NTArgs |
| 39 | +set CMD_LINE_ARGS=%$ |
| 40 | +goto WinNTGetScriptDir |
| 41 | + |
| 42 | +:Win9xArg |
| 43 | +@REM Slurp the command line arguments. This loop allows for an unlimited number |
| 44 | +@REM of arguments (up to the command line limit, anyway). |
| 45 | +set CMD_LINE_ARGS= |
| 46 | +:Win9xApp |
| 47 | +if %1a==a goto Win9xGetScriptDir |
| 48 | +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 |
| 49 | +shift |
| 50 | +goto Win9xApp |
| 51 | + |
| 52 | +:Win9xGetScriptDir |
| 53 | +set SAVEDIR=%CD% |
| 54 | +%0\ |
| 55 | +cd %0\..\.. |
| 56 | +set BASEDIR=%CD% |
| 57 | +cd %SAVEDIR% |
| 58 | +set SAVE_DIR= |
| 59 | +goto repoSetup |
| 60 | + |
| 61 | +:WinNTGetScriptDir |
| 62 | +for %%i in ("%~dp0..") do set "BASEDIR=%%~fi" |
| 63 | + |
| 64 | +:repoSetup |
| 65 | +set REPO= |
| 66 | + |
| 67 | + |
| 68 | +if "%JAVACMD%"=="" set JAVACMD=java |
| 69 | + |
| 70 | +if "%REPO%"=="" set REPO=%BASEDIR%\lib |
| 71 | + |
| 72 | +set CLASSPATH="%BASEDIR%"\plugins\*;"%REPO%"\* |
| 73 | + |
| 74 | +set ENDORSED_DIR= |
| 75 | +if NOT "%ENDORSED_DIR%" == "" set CLASSPATH="%BASEDIR%"\%ENDORSED_DIR%\*;%CLASSPATH% |
| 76 | + |
| 77 | +if NOT "%CLASSPATH_PREFIX%" == "" set CLASSPATH=%CLASSPATH_PREFIX%;%CLASSPATH% |
| 78 | + |
| 79 | +@REM Reaching here means variables are defined and arguments have been captured |
| 80 | +:endInit |
| 81 | + |
| 82 | +%JAVACMD% %JAVA_OPTS% -classpath %CLASSPATH% -Dapp.name="dependency-check" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" org.owasp.dependencycheck.App %CMD_LINE_ARGS% |
| 83 | +if %ERRORLEVEL% NEQ 0 goto error |
| 84 | +goto end |
| 85 | + |
| 86 | +:error |
| 87 | +if "%OS%"=="Windows_NT" @endlocal |
| 88 | +set ERROR_CODE=%ERRORLEVEL% |
| 89 | + |
| 90 | +:end |
| 91 | +@REM set local scope for the variables with windows NT shell |
| 92 | +if "%OS%"=="Windows_NT" goto endNT |
| 93 | + |
| 94 | +@REM For old DOS remove the set variables from ENV - we assume they were not set |
| 95 | +@REM before we started - at least we don't leave any baggage around |
| 96 | +set CMD_LINE_ARGS= |
| 97 | +goto postExec |
| 98 | + |
| 99 | +:endNT |
| 100 | +@REM If error code is set to 1 then the endlocal was done already in :error. |
| 101 | +if %ERROR_CODE% EQU 0 @endlocal |
| 102 | + |
| 103 | + |
| 104 | +:postExec |
| 105 | + |
| 106 | +if "%FORCE_EXIT_ON_ERROR%" == "on" ( |
| 107 | + if %ERROR_CODE% NEQ 0 exit %ERROR_CODE% |
| 108 | +) |
| 109 | + |
| 110 | +exit /B %ERROR_CODE% |
0 commit comments