1 @if not defined _echo @echo off
2 setlocal EnableDelayedExpansion
19 if [%1]==[] goto Begin
21 if /I [%1] == [-?] goto Usage
22 if /I [%1] == [-help] goto Usage
26 set thisArgs=!thisArgs!%1
32 set thisArgs=!thisArgs!%1
38 set thisArgs=!thisArgs!%1
42 if /I [%1] == [-all] (
55 :: Set __ProjectDir to be the directory of this script
56 set "__ProjectDir=%~dp0"
57 :: remove trailing slash
58 if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
59 set "__RootBinDir=%__ProjectDir%\bin"
61 :: Check if VBCSCompiler.exe is running and stop it
62 tasklist /fi "imagename eq VBCSCompiler.exe" |find ":" > nul
64 echo Stop VBCSCompiler.exe execution.
65 for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq VBCSCompiler.exe" /fo csv') do taskkill /f /PID %%~F
68 if [%bin%] == [true] (
69 if exist "%__RootBinDir%" (
70 echo Deleting bin directory
71 rd /s /q "%__RootBinDir%"
72 if NOT [!ERRORLEVEL!]==[0] (
73 echo ERROR: An error occurred while deleting the bin directory - error code is !ERRORLEVEL!
79 if [%tools%] == [true] (
80 if exist "%__ProjectDir%\Tools" (
81 echo Deleting tools directory
82 rd /s /q "%__ProjectDir%\Tools"
83 if NOT [!ERRORLEVEL!]==[0] (
84 echo ERROR: An error occurred while deleting the Tools directory - error code is !ERRORLEVEL!
90 if [%packages%] == [true] (
91 if exist "%__ProjectDir%\packages" (
92 echo Deleting packages directory
93 rd /s /q "%__ProjectDir%\packages"
94 if NOT [!ERRORLEVEL!]==[0] (
95 echo ERROR: An error occurred while deleting the packages directory - error code is !ERRORLEVEL!
101 if [%all%] == [true] (
102 echo Cleaning entire working directory ...
107 echo Clean was successful
112 echo Repository cleaning script.
114 echo -b - Cleans the bin directory
115 echo -p - Cleans the packages directory
116 echo -t - Cleans the tools directory
117 echo -all - Cleans everything and restores repository to pristine state
119 echo If no option is specified then clean.cmd -b -p -t is implied.