@ECHO OFF

REM create bin directory if it doesn't exist
if not exist ..\bin mkdir ..\bin

REM compile the code into the bin folder
javac  ..\src\seedu\addressbook\Addressbook.java -d ..\bin
IF ERRORLEVEL 1 (
    echo ********** BUILD FAILURE **********
    exit /b 1
)
REM no error here, errorlevel == 0

REM (invalid) no parent directory, invalid filename with no extension
java -classpath ..\bin seedu.addressbook.AddressBook " " < NUL > actual.txt
REM (invalid) invalid parent directory that does not exist, valid filename
java -classpath ..\bin seedu.addressbook.AddressBook "directoryThatDoesNotExist/valid.filename" < NUL >> actual.txt
REM (invalid) no parent directory, invalid filename with dot on first character
java -classpath ..\bin seedu.addressbook.AddressBook ".noFilename" < NUL >> actual.txt
REM (invalid) valid parent directory, non regular file
if not exist data\notRegularFile.txt mkdir data\notRegularFile.txt
java -classpath ..\bin seedu.addressbook.AddressBook "data/notRegularFile.txt" < NUL >> actual.txt
REM (valid) valid parent directory, valid filename with extension.
copy /y NUL data\valid.filename
java -classpath ..\bin seedu.addressbook.AddressBook "data/valid.filename" < exitinput.txt >> actual.txt
REM run the program, feed commands from input.txt file and redirect the output to the actual.txt
java -classpath ..\bin seedu.addressbook.AddressBook < input.txt >> actual.txt

REM compare the output to the expected output
FC actual.txt expected.txt

@ECHO OFF

REM change current directory to the location of this script
pushd %~dp0

REM create bin directory if it doesn't exist
if not exist ..\bin mkdir ..\bin

REM compile the code into the bin folder
javac  ..\src\seedu\addressbook\Addressbook.java -d ..\bin
IF ERRORLEVEL 1 (
    echo ********** BUILD FAILURE **********
    REM return to previous directory
    popd
    exit /b 1
)
REM no error here, errorlevel == 0

REM (invalid) no parent directory, invalid filename with no extension
java -classpath ..\bin seedu.addressbook.AddressBook " " < NUL > actual.txt
REM (invalid) invalid parent directory that does not exist, valid filename
java -classpath ..\bin seedu.addressbook.AddressBook "directoryThatDoesNotExist/valid.filename" < NUL >> actual.txt
REM (invalid) no parent directory, invalid filename with dot on first character
java -classpath ..\bin seedu.addressbook.AddressBook ".noFilename" < NUL >> actual.txt
REM (invalid) valid parent directory, non regular file
if not exist data\notRegularFile.txt mkdir data\notRegularFile.txt
java -classpath ..\bin seedu.addressbook.AddressBook "data/notRegularFile.txt" < NUL >> actual.txt
REM (valid) valid parent directory, valid filename with extension.
copy /y NUL data\valid.filename
java -classpath ..\bin seedu.addressbook.AddressBook "data/valid.filename" < exitinput.txt >> actual.txt
REM run the program, feed commands from input.txt file and redirect the output to the actual.txt
java -classpath ..\bin seedu.addressbook.AddressBook < input.txt >> actual.txt

REM compare the output to the expected output
FC actual.txt expected.txt

REM return to previous directory
popd

[#107] runtests.bat: Allow user to run script outside test folder (#108)

runtests.bat script does not work outside the test folder.

Developers working on the project often have their working directory
set to the root of the project. It is inconvenient to switch in and out
of the test folder repeatedly in an edit-debug cycle.

To reduce the hassle, let's add the commands in bat script to perform
the switching of directory automatically and hence increase our
productivity.


@echo off

Echo Clear previulsly defined GalleryUrl
set GalleryURl=

SET Param=%1
if "%Param%" NEQ "" (
ECHO Param is defined. Setting GalleryUrl to %Param%.
SET GalleryUrl=%Param%
)

REM If GalleryUrl is still not defined, the default is to use int.nugettest.org
if "%GalleryUrl%"=="" (
ECHO Setting GalleryUrl to the default - int.nugettest.org
SET GalleryUrl=https://int.nugettest.org/
)
ECHO The NuGet gallery tests are running against %GalleryUrl%

If Exist ""%VS120COMNTOOLS%"\..\IDE\mstest.exe" (
   set toolpath=%VS120COMNTOOLS%
   set VisualStudioVersion=12.0
   goto Run
)

If Exist ""%VS110COMNTOOLS%"..\IDE\mstest.exe" (
   set toolpath=%VS110COMNTOOLS%
   set VisualStudioVersion=11.0
   goto Run
)

:Error
Echo The variable toolpath is not set correctly. check your visual studio install. Exiting without running tests...
goto End

:Run
Echo.
Echo. Build the NuGet Gallery solution...
call ..\..\build.cmd
Echo Done.
Echo.

Echo Build the NuGet Gallery Fluent test solution...
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:OutputPath=bin\ ..\NuGetGallery.FunctionalTests.Fluent\NuGetGallery.FunctionalTests.Fluent.sln
Echo Done.
Echo.

Echo Start running all NuGet Gallery Functional tests...
Echo The path to mstest.exe is "%toolpath%..\IDE\mstest.exe"
"%toolpath%..\IDE\mstest.exe"  /testsettings:"..\Local.testsettings" /testmetadata:"..\NuGetGallery.FunctionalTests.vsmdi"
Echo Finished running NuGet Gallery Functional tests...
Echo Exit.

:End
exit /b 0

@echo off

Echo Clear previulsly defined GalleryUrl
set GalleryURl=

SET Param=%1
if "%Param%" NEQ "" (
ECHO Param is defined. Setting GalleryUrl to %Param%.
SET GalleryUrl=%Param%
)

REM If GalleryUrl is still not defined, the default is to use int.nugettest.org
if "%GalleryUrl%"=="" (
ECHO Setting GalleryUrl to the default - int.nugettest.org
SET GalleryUrl=https://int.nugettest.org/
)
ECHO The NuGet gallery tests are running against %GalleryUrl%

If Exist ""%VS120COMNTOOLS%"\..\IDE\mstest.exe" (
   set toolpath=%VS120COMNTOOLS%
   set VisualStudioVersion=12.0
   goto Run
)

If Exist ""%VS110COMNTOOLS%"..\IDE\mstest.exe" (
   set toolpath=%VS110COMNTOOLS%
   set VisualStudioVersion=11.0
   goto Run
)

:Error
Echo The variable toolpath is not set correctly. check your visual studio install. Exiting without running tests...
goto End

:Run
Echo.
Echo. Build the NuGet Gallery solution...
call ..\..\build.cmd
Echo Done.
Echo.

Echo Build the NuGet Gallery test solution...
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ..\NuGetGallery.FunctionalTests.sln
Echo Done.
Echo.

Echo Start running all NuGet Gallery Functional tests...
Echo The path to mstest.exe is "%toolpath%..\IDE\mstest.exe"
"%toolpath%..\IDE\mstest.exe"  /testsettings:"..\Local.testsettings" /testmetadata:"..\NuGetGallery.FunctionalTests.vsmdi"
Echo Finished running NuGet Gallery Functional tests...
Echo Exit.

:End
exit /b 0

Update the run script to build new test solution


@REM Copyright 2014 Benjamin Lerer
@REM
@REM  Licensed under the Apache License, Version 2.0 (the "License");
@REM  you may not use this file except in compliance with the License.
@REM  You may obtain a copy of the License at
@REM
@REM  http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM  Unless required by applicable law or agreed to in writing, software
@REM  distributed under the License is distributed on an "AS IS" BASIS,
@REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM  See the License for the specific language governing permissions and
@REM  limitations under the License.
@REM

@echo off
if "%OS%" == "Windows_NT" SETLOCAL

pushd %~dp0..
if NOT DEFINED HORIZONDB_HOME set HORIZONDB_HOME=%CD%
popd

if NOT DEFINED HORIZONDB_MAIN set HORIZONDB_MAIN=io.horizondb.db.HorizonDbDaemon
if NOT DEFINED JAVA_HOME goto :err

set JAVA_OPTS=-Xms1G^
 -Xmx1G^
 -XX:+HeapDumpOnOutOfMemoryError^
 -XX:+UseParNewGC^
 -XX:+UseConcMarkSweepGC^
 -XX:+CMSParallelRemarkEnabled^
 -XX:SurvivorRatio=8^
 -XX:MaxTenuringThreshold=1^
 -XX:CMSInitiatingOccupancyFraction=75^
 -XX:+UseCMSInitiatingOccupancyOnly

set CLASSPATH="HORIZONDB_HOME%\conf"

for %%i in ("%HORIZONDB_HOME%\lib\*.jar") do call :append "%%i"
goto :runDaemon

:append
set CLASSPATH=%CLASSPATH%;%1
goto :eof

:runDaemon
echo Starting HorizonDB
"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp %CLASSPATH% "%HORIZONDB_MAIN%"
goto finally

:err
echo JAVA_HOME environment variable must be set
pause

:finally

ENDLOCAL

@REM Copyright 2014 Benjamin Lerer
@REM
@REM  Licensed under the Apache License, Version 2.0 (the "License");
@REM  you may not use this file except in compliance with the License.
@REM  You may obtain a copy of the License at
@REM
@REM  http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM  Unless required by applicable law or agreed to in writing, software
@REM  distributed under the License is distributed on an "AS IS" BASIS,
@REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM  See the License for the specific language governing permissions and
@REM  limitations under the License.
@REM

@echo off
if "%OS%" == "Windows_NT" SETLOCAL

pushd %~dp0..
if NOT DEFINED HORIZONDB_HOME set HORIZONDB_HOME=%CD%
popd

if NOT DEFINED HORIZONDB_MAIN set HORIZONDB_MAIN=io.horizondb.db.HorizonDbDaemon
if NOT DEFINED JAVA_HOME goto :err

set JAVA_OPTS=-Xms1G^
 -Xmx1G^
 -XX:+HeapDumpOnOutOfMemoryError^
 -XX:+UseParNewGC^
 -XX:+UseConcMarkSweepGC^
 -XX:+CMSParallelRemarkEnabled^
 -XX:SurvivorRatio=8^
 -XX:MaxTenuringThreshold=1^
 -XX:CMSInitiatingOccupancyFraction=75^
 -XX:+UseCMSInitiatingOccupancyOnly

set CLASSPATH="%HORIZONDB_HOME%\conf"

for %%i in ("%HORIZONDB_HOME%\lib\*.jar") do call :append "%%i"
goto :runDaemon

:append
set CLASSPATH=%CLASSPATH%;%1
goto :eof

:runDaemon
echo Starting HorizonDB
"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp %CLASSPATH% "%HORIZONDB_MAIN%"
goto finally

:err
echo JAVA_HOME environment variable must be set
pause

:finally

ENDLOCAL

Fix missing % in the classpath

Fix missing % in the classpath


:: setup variables which are used in Visual Studio project.
@echo off
call setup_environment.bat > nul

set BOOST_DIR=c:\libraries\boost\boost_1_52_0
set FREEIMAGELIB_DIR=c:\libraries\FreeImage\%FreeImage_VERSION%
set AIMP_PLUGINS_DIR=c:\AIMP\AIMP3.55.1312_RC2\Plugins
::set AIMP_PLUGINS_DIR=%ProgramFiles%\AIMP3\Plugins
set AIMP_PLUGINS_DIR=c:\AIMP\AIMP3.55.1320\Plugins

change default test player: use 3.55.1320.


:: USAGE
::     cmdize name [...]
::
:: This tool converts a supported code into a batch file that can be
:: executed without explicit invoking the executable engine. The script
:: creates new file and places it under the same directory as the original
:: one with the same name, replacing the original extension with ".bat".
:: The content of the new file consists of the original file and the
:: special header that being the "polyglot" and having some tricks to be a
:: valid code in batch file and the wrapped code at the same time.
::
:: FEATURES
:: It does comment on "Option Explicit" in VBScript.
:: "<?xml?>" declaration for wsf-files is expected.
:: "Option Explicit" and "<?xml?>" in a single line only are supported.
:: BOM is not supported at all.
::
:: SEE ALSO
:: Proceed the following links to learn more the origins
::
:: .js
:: http://forum.script-coding.com/viewtopic.php?pid=79210#p79210
:: http://www.dostips.com/forum/viewtopic.php?p=33879#p33879
::
:: .vbs
:: http://www.dostips.com/forum/viewtopic.php?p=33882#p33882
:: http://www.dostips.com/forum/viewtopic.php?p=32485#p32485
::
:: .pl
:: For details and better support see "pl2bat.bat" from Perl distribution
::
:: .ps1
:: http://blogs.msdn.com/b/jaybaz_ms/archive/2007/04/26/powershell-polyglot.aspx
:: http://stackoverflow.com/a/2611487/3627676
::
:: .hta and .html?
:: http://forum.script-coding.com/viewtopic.php?pid=79322#p79322
::
:: .wsf
:: http://www.dostips.com/forum/viewtopic.php?p=33963#p33963
::
:: COPYRIGHTS
:: Copyright (c) 2014 Ildar Shaimordanov

@echo off

if "%~1" == "" (
	for %%p in ( powershell.exe ) do if not "%%~$PATH:p" == "" (
		"%%~$PATH:p" -NoProfile -NoLogo -Command "cat '%~f0' | where { $_ -match '^::' } | %% { $_ -replace '::', '' }"
		goto :EOF
	)
	for /f "usebackq tokens=* delims=:" %%s in ( "%~f0" ) do (
		if /i "%%s" == "@echo off" goto :EOF
		echo:%%s
	)
	goto :EOF
)

:cmdize.loop.begin
if "%~1" == "" goto :cmdize.loop.end

if not exist "%~f1" (
	echo:%~n0: File not found: "%~1">&2
	goto :cmdize.loop.continue
)

for %%x in ( .js .vbs .pl .ps1 .hta .htm .html .wsf ) do (
	if /i "%~x1" == "%%~x" (
		call :cmdize%%~x "%~1" >"%~dpn1.bat"
		goto :cmdize.loop.continue
	)
)

echo:%~n0: Unsupported extension: "%~1">&2

:cmdize.loop.continue

shift

goto :cmdize.loop.begin
:cmdize.loop.end

goto :EOF

:cmdize.js
echo:@if ^(true == false^) @end /*!
echo:@echo off
echo:"%%windir%%\System32\cscript.exe" //nologo //e:javascript "%%~f0" %%*
echo:goto :EOF */
type "%~f1"
goto :EOF

:cmdize.vbs.h
set /p "=::'" <nul
type "%TEMP%\%~n0.$$"
echo:%*
goto :EOF

:cmdize.vbs
copy /y nul + nul /a "%TEMP%\%~n0.$$" /a 1>nul

call :cmdize.vbs.h @echo off
call :cmdize.vbs.h "%%%%windir%%%%\System32\cscript.exe" //nologo //e:vbscript "%%%%~f0" %%%%*
call :cmdize.vbs.h goto :EOF

del /q "%TEMP%\%~n0.$$"
rem type "%~f1"
for /f "tokens=1,* delims=]" %%r in ( ' call "%windir%\System32\find.exe" /n /v "" ^<"%~f1" ' ) do (
	rem Filtering and commenting "Option Explicit".
	rem This ugly code tries as much as possible to recognize and
	rem comment this directive. It fails if "Option" and "Explicit"
	rem are located on two neighbor lines, consecutively, one by one.
	rem But it is too hard to imagine that there is someone who
	rem practices such a strange coding style.
	for /f "usebackq tokens=1,2" %%a in ( '%%s' ) do if /i "%%~a" == "Option" for /f "usebackq tokens=1,* delims=:'" %%i in ( 'x%%b' ) do if /i "%%~i" == "xExplicit" (
		echo:%~n0: Commenting Option Explicit in "%~1">&2
		echo:rem To prevent compilation error due to embedding into a batch file,
		echo:rem the following line was commented automatically.
		set /p "=rem " <nul
	)
	echo:%%s
)
goto :EOF

:cmdize.pl
echo:@rem = '--*-Perl-*--
echo:@echo off
echo:perl -x -S "%%~f0" %%*
echo:goto :EOF
echo:@rem ';
echo:#!perl
type "%~f1"
goto :EOF

:cmdize.ps1
echo:^<# :
echo:@echo off
echo:setlocal
echo:set "POWERSHELL_BAT_ARGS=%%*"
echo:if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%%POWERSHELL_BAT_ARGS:"=\"%%"
echo:endlocal ^& powershell -Command "Invoke-Expression $( '$args = @( &{ $args } %%POWERSHELL_BAT_ARGS%% );' + [String]::Join( [char]10, $( Get-Content \"%%~f0\" ) ) )"
echo:goto :EOF
echo:#^>
type "%~f1"
goto :EOF

:cmdize.hta
:cmdize.htm
:cmdize.html
echo:^<!-- :
echo:@echo off
echo:start "" "%%windir%%\System32\mshta.exe" "%%~f0" %%*
echo:goto :EOF
echo:--^>
type "%~f1"
goto :EOF

:cmdize.wsf
for /f "usebackq tokens=1,2,* delims=?" %%a in ( "%~f1" ) do for /f "tokens=1,*" %%d in ( "%%b" ) do (
	rem We use this code to transform the "<?xml?> declaration located
	rem at the very beginning of the file to the "polyglot" to do it
	rem acceptable by the batch file.
	echo:%%a?%%d :
	echo:: %%e ?^>^<!--
	echo:@echo off
	echo:"%%windir%%\System32\cscript.exe" //nologo "%%~f0?.wsf" %%*
	echo:goto :EOF
	echo:: --%%c
	more +1 <"%~f1"
	goto :EOF
)
goto :EOF

rem EOF

:: USAGE
::     cmdize name [...]
::
:: This tool converts a supported code into a batch file that can be
:: executed without explicit invoking the executable engine. The script
:: creates new file and places it under the same directory as the original
:: one with the same name, replacing the original extension with ".bat".
:: The content of the new file consists of the original file and the
:: special header that being the "polyglot" and having some tricks to be a
:: valid code in batch file and the wrapped code at the same time.
::
:: FEATURES
:: It does comment on "Option Explicit" in VBScript.
:: "<?xml?>" declaration for wsf-files is expected.
:: "Option Explicit" and "<?xml?>" in a single line only are supported.
:: BOM is not supported at all.
::
:: SEE ALSO
:: Proceed the following links to learn more the origins
::
:: .js
:: http://forum.script-coding.com/viewtopic.php?pid=79210#p79210
:: http://www.dostips.com/forum/viewtopic.php?p=33879#p33879
::
:: .vbs
:: http://www.dostips.com/forum/viewtopic.php?p=33882#p33882
:: http://www.dostips.com/forum/viewtopic.php?p=32485#p32485
::
:: .pl
:: For details and better support see "pl2bat.bat" from Perl distribution
::
:: .ps1
:: http://blogs.msdn.com/b/jaybaz_ms/archive/2007/04/26/powershell-polyglot.aspx
:: http://stackoverflow.com/a/2611487/3627676
::
:: .hta and .html?
:: http://forum.script-coding.com/viewtopic.php?pid=79322#p79322
::
:: .wsf
:: http://www.dostips.com/forum/viewtopic.php?p=33963#p33963
::
:: COPYRIGHTS
:: Copyright (c) 2014 Ildar Shaimordanov

@echo off

if "%~1" == "" (
	for %%p in ( powershell.exe ) do if not "%%~$PATH:p" == "" (
		"%%~$PATH:p" -NoProfile -NoLogo -Command "cat '%~f0' | where { $_ -match '^::' } | %% { $_ -replace '::', '' }"
		goto :EOF
	)
	for /f "usebackq tokens=* delims=:" %%s in ( "%~f0" ) do (
		if /i "%%s" == "@echo off" goto :EOF
		echo:%%s
	)
	goto :EOF
)

:cmdize.loop.begin
if "%~1" == "" goto :cmdize.loop.end

if not exist "%~f1" (
	echo:%~n0: File not found: "%~1">&2
	goto :cmdize.loop.continue
)

for %%x in ( .js .vbs .pl .ps1 .hta .htm .html .wsf ) do (
	if /i "%~x1" == "%%~x" (
		call :cmdize%%~x "%~1" >"%~dpn1.bat"
		goto :cmdize.loop.continue
	)
)

echo:%~n0: Unsupported extension: "%~1">&2

:cmdize.loop.continue

shift

goto :cmdize.loop.begin
:cmdize.loop.end

goto :EOF

:cmdize.js
echo:@if ^(true == false^) @end /*!
echo:@echo off
echo:"%%windir%%\System32\cscript.exe" //nologo //e:javascript "%%~f0" %%*
echo:goto :EOF */
type "%~f1"
goto :EOF

:cmdize.vbs.h
set /p "=::'" <nul
type "%TEMP%\%~n0.$$"
echo:%*
goto :EOF

:cmdize.vbs
copy /y nul + nul /a "%TEMP%\%~n0.$$" /a 1>nul

call :cmdize.vbs.h @echo off
call :cmdize.vbs.h "%%%%windir%%%%\System32\cscript.exe" //nologo //e:vbscript "%%%%~f0" %%%%*
call :cmdize.vbs.h goto :EOF

del /q "%TEMP%\%~n0.$$"
rem type "%~f1"
for /f "tokens=1,* delims=]" %%r in ( ' call "%windir%\System32\find.exe" /n /v "" ^<"%~f1" ' ) do (
	rem Filtering and commenting "Option Explicit".
	rem This ugly code tries as much as possible to recognize and
	rem comment this directive. It fails if "Option" and "Explicit"
	rem are located on two neighbor lines, consecutively, one by one.
	rem But it is too hard to imagine that there is someone who
	rem practices such a strange coding style.
	for /f "usebackq tokens=1,2" %%a in ( '%%s' ) do if /i "%%~a" == "Option" for /f "usebackq tokens=1,* delims=:'" %%i in ( 'x%%b' ) do if /i "%%~i" == "xExplicit" (
		echo:%~n0: Commenting Option Explicit in "%~1">&2
		echo:rem To prevent compilation error due to embedding into a batch file,
		echo:rem the following line was commented automatically.
		set /p "=rem " <nul
	)
	echo:%%s
)
goto :EOF

:cmdize.pl
echo:@rem = '--*-Perl-*--
echo:@echo off
echo:perl -x -S "%%~f0" %%*
echo:goto :EOF
echo:@rem ';
echo:#!perl
type "%~f1"
goto :EOF

:cmdize.ps1
echo:^<# :
echo:@echo off
echo:setlocal
echo:set "POWERSHELL_BAT_ARGS=%%*"
echo:if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%%POWERSHELL_BAT_ARGS:"=\"%%"
echo:endlocal ^& powershell -Command "Invoke-Expression $( '$args = @( &{ $args } %%POWERSHELL_BAT_ARGS%% );' + [String]::Join( [char]10, $( Get-Content \"%%~f0\" ) ) )"
echo:goto :EOF
echo:#^>
type "%~f1"
goto :EOF

:cmdize.hta
:cmdize.htm
:cmdize.html
echo:^<!-- :
echo:@echo off
echo:start "" "%%windir%%\System32\mshta.exe" "%%~f0" %%*
echo:goto :EOF
echo:--^>
type "%~f1"
goto :EOF

:cmdize.wsf
for /f "usebackq tokens=1,2,* delims=?" %%a in ( "%~f1" ) do for /f "tokens=1,*" %%d in ( "%%b" ) do (
	rem We use this code to transform the "<?xml?>" declaration
	rem located at the very beginning of the file to the "polyglot"
	rem form to do it acceptable by the batch file.
	echo:%%a?%%d :
	echo:: %%e ?^>^<!--
	echo:@echo off
	echo:"%%windir%%\System32\cscript.exe" //nologo "%%~f0?.wsf" %%*
	echo:goto :EOF
	echo:: --%%c
	more +1 <"%~f1"
	goto :EOF
)
goto :EOF

rem EOF

fix typos in comments

cmdize.bat: fix typos in comments


@echo off

reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath > nul 2>&1
if ERRORLEVEL 1 goto MissingMSBuildRegistry

for /f "skip=2 tokens=2,*" %%A in ('reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath') do SET MSBUILDDIR=%%B

IF NOT EXIST %MSBUILDDIR%nul goto MissingMSBuildToolsPath
IF NOT EXIST %MSBUILDDIR%msbuild.exe goto MissingMSBuildExe

:: "%MSBUILDDIR%msbuild.exe" /?
"%MSBUILDDIR%msbuild.exe" PsikonStats.sln /v:d /t:clean /p:Configuration=%1
"%MSBUILDDIR%msbuild.exe" PsikonStats.sln /v:d /t:rebuild /p:Configuration=%1

goto:eof
::ERRORS
::---------------------
:MissingMSBuildRegistry
echo Cannot obtain path to MSBuild tools from registry
goto:eof
:MissingMSBuildToolsPath
echo The MSBuild tools path from the registry '%MSBUILDDIR%' does not exist
goto:eof
:MissingMSBuildExe
echo The MSBuild executable could not be found at '%MSBUILDDIR%'
goto:eof

@echo off

reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath > nul 2>&1
if ERRORLEVEL 1 goto MissingMSBuildRegistry

for /f "skip=2 tokens=2,*" %%A in ('reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath') do SET MSBUILDDIR=%%B

IF NOT EXIST %MSBUILDDIR%nul goto MissingMSBuildToolsPath
IF NOT EXIST %MSBUILDDIR%msbuild.exe goto MissingMSBuildExe

:: "%MSBUILDDIR%msbuild.exe" /?
"%MSBUILDDIR%msbuild.exe" PsikonStats.sln /v:d /t:rebuild /p:Configuration=%1

goto:eof
::ERRORS
::---------------------
:MissingMSBuildRegistry
echo Cannot obtain path to MSBuild tools from registry
goto:eof
:MissingMSBuildToolsPath
echo The MSBuild tools path from the registry '%MSBUILDDIR%' does not exist
goto:eof
:MissingMSBuildExe
echo The MSBuild executable could not be found at '%MSBUILDDIR%'
goto:eof

remove unnecessary clean step

remove unnecessary clean step


@echo off

:: Make sure this is a decent name and not generic
set exe_name=odin.exe

:: Debug = 0, Release = 1
if "%1" == "1" (
	set release_mode=1
) else if "%1" == "release" (
	set release_mode=1
) else (
	set release_mode=0
)

:: Normal = 0, CI Nightly = 1
if "%2" == "1" (
    set nightly=1
) else (
    set nightly=0
)

set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF
set compiler_defines=

for /f %%i in ('git rev-parse --short HEAD') do set GIT_SHA=%%i
if %ERRORLEVEL% equ 0 set compiler_defines=%compiler_defines% -DGIT_SHA=\"%GIT_SHA%\"
if %nightly% equ 1 set compiler_defines=%compiler_defines% -DNIGHTLY

if %release_mode% EQU 0 ( rem Debug
	set compiler_flags=%compiler_flags% -Od -MDd -Z7
) else ( rem Release
	set compiler_flags=%compiler_flags% -O2 -MT -Z7
	set compiler_defines=%compiler_defines% -DNO_ARRAY_BOUNDS_CHECK
)

set compiler_warnings= ^
	-W4 -WX ^
	-wd4100 -wd4101 -wd4127 -wd4189 ^
	-wd4201 -wd4204 ^
	-wd4456 -wd4457 -wd4480 ^
	-wd4512

set compiler_includes=
set libs= ^
	kernel32.lib ^
	bin\llvm\windows\LLVM-C.lib

set linker_flags= -incremental:no -opt:ref -subsystem:console

if %release_mode% EQU 0 ( rem Debug
	set linker_flags=%linker_flags% -debug
) else ( rem Release
	set linker_flags=%linker_flags% -debug
)

set compiler_settings=%compiler_includes% %compiler_flags% %compiler_warnings% %compiler_defines%
set linker_settings=%libs% %linker_flags%

del *.pdb > NUL 2> NUL
del *.ilk > NUL 2> NUL

rem cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name%

cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% ^
	&& odin run examples/demo

if %errorlevel% neq 0 goto end_of_build
rem if %release_mode% EQU 0 odin run examples/demo/demo.odin

del *.obj > NUL 2> NUL

:end_of_build

@echo off

:: Make sure this is a decent name and not generic
set exe_name=odin.exe

:: Debug = 0, Release = 1
if "%1" == "1" (
	set release_mode=1
) else if "%1" == "release" (
	set release_mode=1
) else (
	set release_mode=0
)

:: Normal = 0, CI Nightly = 1
if "%2" == "1" (
    set nightly=1
) else (
    set nightly=0
)

set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF
set compiler_defines=

for /f %%i in ('git rev-parse --short HEAD') do set GIT_SHA=%%i
if %ERRORLEVEL% equ 0 set compiler_defines=%compiler_defines% -DGIT_SHA=\"%GIT_SHA%\"
if %nightly% equ 1 set compiler_defines=%compiler_defines% -DNIGHTLY

if %release_mode% EQU 0 ( rem Debug
	set compiler_flags=%compiler_flags% -Od -MDd -Z7
) else ( rem Release
	set compiler_flags=%compiler_flags% -O2 -MT -Z7
	set compiler_defines=%compiler_defines% -DNO_ARRAY_BOUNDS_CHECK
)

set compiler_warnings= ^
	-W4 -WX ^
	-wd4100 -wd4101 -wd4127 -wd4189 ^
	-wd4201 -wd4204 ^
	-wd4456 -wd4457 -wd4480 ^
	-wd4512

set compiler_includes=
set libs= ^
	kernel32.lib ^
	bin\llvm\windows\LLVM-C.lib

set linker_flags= -incremental:no -opt:ref -subsystem:console

if %release_mode% EQU 0 ( rem Debug
	set linker_flags=%linker_flags% -debug
) else ( rem Release
	set linker_flags=%linker_flags% -debug
)

set compiler_settings=%compiler_includes% %compiler_flags% %compiler_warnings% %compiler_defines%
set linker_settings=%libs% %linker_flags%

del *.pdb > NUL 2> NUL
del *.ilk > NUL 2> NUL

rem cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name%

cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% ^
	&& odin run examples/demo

if %errorlevel% neq 0 goto end_of_build
if %release_mode% EQU 0 odin run examples/demo/demo.odin

del *.obj > NUL 2> NUL

:end_of_build

Revert build.bat

Revert build.bat


@echo Off
set config=%1
if "%config%" == "" (
   set config=Release
)

set version=1.0.0
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

set nuget=
if "%nuget%" == "" (
	set nuget=nuget
)

%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild src\Titanium.Web.Proxy /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=diag /nr:false

mkdir Build
mkdir Build\lib
mkdir Build\lib\net40

%nuget% pack "Titanium.Web.Proxy.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

@echo Off
set config=%1
if "%config%" == "" (
   set config=Release
)

set version=1.0.0
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

set nuget=
if "%nuget%" == "" (
	set nuget=nuget
)

%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild Titanium.Web.Proxy.sln /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=diag /nr:false

mkdir Build

%nuget% pack "Titanium.Web.Proxy.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

Fix build script

Fix build script


@echo off

pushd %~dp0

SET PACKAGEPATH=.\packages\
SET NUGET=.\tools\nuget\NuGet.exe
SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion

IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.25.4 (
  RD /S/Q %PACKAGEPATH%FAKE
  %NUGET% install FAKE -Version 4.25.4 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE\Ver_4.25.4
)

IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.5 (
  RD /S/Q %PACKAGEPATH%FAKE.BuildLib
  %NUGET% install FAKE.BuildLib -Version 0.3.5 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.5
)

set encoding=utf-8
"%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*

popd

@echo off

pushd %~dp0

SET PACKAGEPATH=.\packages\
SET NUGET=.\tools\nuget\NuGet.exe
SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion

IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.28.0 (
  RD /S/Q %PACKAGEPATH%FAKE
  %NUGET% install FAKE -Version 4.28.0 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE\Ver_4.28.0
)

IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.6 (
  RD /S/Q %PACKAGEPATH%FAKE.BuildLib
  %NUGET% install FAKE.BuildLib -Version 0.3.6 %NUGETOPTIONS%
  COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.6
)

set encoding=utf-8
"%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*

popd

Use BuildLib 0.3.6

Use BuildLib 0.3.6


@echo on
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
.nuget\NuGet.exe install FSharpSupport -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre

IF "%SKIP_KRE_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\kvm upgrade -svr50 -x86
REM CALL packages\KoreBuild\build\kvm install default -svrc50 -x86

:run
cd src\FSharpSupport

SET ERRORLEVEL=
echo klr --lib "%USERPROFILE%\.klr;%USERPROFILE%\.klr\lib\Microsoft.Framework.PackageManager;%~dp0\packages\FSharpSupport\lib\net45" "Microsoft.Framework.PackageManager" build
call klr --lib "%USERPROFILE%\.klr;%USERPROFILE%\.klr\lib\Microsoft.Framework.PackageManager;%~dp0\packages\FSharpSupport\lib\net45" "Microsoft.Framework.PackageManager" build
exit /b %ERRORLEVEL%

echo DONE

@echo on
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
.nuget\NuGet.exe install FSharpSupport -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre

IF "%SKIP_KRE_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\kvm upgrade -svr50 -x86
REM CALL packages\KoreBuild\build\kvm install default -svrc50 -x86

:run
cd src\FSharpSupport

SET ERRORLEVEL=
echo klr --lib "%USERPROFILE%\.kre;%USERPROFILE%\.kre\lib\Microsoft.Framework.PackageManager;%~dp0\packages\FSharpSupport\lib\net45" "Microsoft.Framework.PackageManager" build
call klr --lib "%USERPROFILE%\.kre;%USERPROFILE%\.kre\lib\Microsoft.Framework.PackageManager;%~dp0\packages\FSharpSupport\lib\net45" "Microsoft.Framework.PackageManager" build
exit /b %ERRORLEVEL%

echo DONE

change klr to kre

change klr to kre


@echo off
cd %~dp0

SETLOCAL
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
SET BUILDCMD_DNX_FEED=https://www.nuget.org/api/v2
SET BUILDCMD_DNX_VERSION=1.0.0-rc1-final

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto sake
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:sake
IF EXIST packages\Sake goto korebuild
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -o packages

:korebuild
IF EXIST packages\Sake goto dnx
.nuget\nuget.exe install KoreBuild -ExcludeVersion -Source https://www.myget.org/F/aspnetvnext/api/v2 -o packages -nocache -pre

:dnx
SET DNX_FEED=%BUILDCMD_DNX_FEED%
CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86
CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -alias default

packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

@echo off
cd %~dp0

SETLOCAL
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
SET BUILDCMD_DNX_FEED=https://www.nuget.org/api/v2
SET BUILDCMD_DNX_VERSION=1.0.0-rc1-final

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto sake
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:sake
IF EXIST packages\Sake goto korebuild
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -o packages

:korebuild
IF EXIST packages\KoreBuild goto dnx
.nuget\nuget.exe install KoreBuild -ExcludeVersion -Source https://www.myget.org/F/aspnetvnext/api/v2 -o packages -nocache -pre

:dnx
SET DNX_FEED=%BUILDCMD_DNX_FEED%
CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86
CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -alias default

packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

fix windows build

fix windows build


set CONDA_PREFIX=%PREFIX%
if errorlevel 1 exit 1

cmake -B build -S "%SRC_DIR%" ^
	-G Ninja ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DPython3_FIND_STRATEGY=LOCATION ^
    -DPython3_ROOT_DIR=%CONDA_PREFIX% ^
    -DCMAKE_LINKER=lld-link.exe ^
    -DCMAKE_MODULE_LINKER_FLAGS="/FORCE:MULTIPLE"
if errorlevel 1 exit 1

cmake --build build -j %CPU_COUNT% -- -v -k 0
if errorlevel 1 exit 1

if not exist "%SP_DIR%" mkdir "%SP_DIR%"
if errorlevel 1 exit 1

copy build/OCP.cp*-*.* "%SP_DIR%"
if errorlevel 1 exit 1

set CONDA_PREFIX=%PREFIX%
if errorlevel 1 exit 1

cmake -B build -S "%SRC_DIR%" ^
	-G Ninja ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DPython3_FIND_STRATEGY=LOCATION ^
    -DPython3_ROOT_DIR=%CONDA_PREFIX% ^
    -DCMAKE_LINKER=lld-link.exe ^
    -DCMAKE_MODULE_LINKER_FLAGS="/machine:x64 /FORCE:MULTIPLE"
if errorlevel 1 exit 1

cmake --build build -j %CPU_COUNT% -- -v -k 0
if errorlevel 1 exit 1

if not exist "%SP_DIR%" mkdir "%SP_DIR%"
if errorlevel 1 exit 1

copy build/OCP.cp*-*.* "%SP_DIR%"
if errorlevel 1 exit 1

Add /machine:x64, flag which was lost when setting /FORCE:MULTIPLE


:: Copyright 2014 by SyneArt <sa@syneart.com>
@echo off&cls&title Install&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion

echo.&echo.&echo.&echo.&echo Install Theme Now ..
set texPath=nul
call tlmgr --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=:" %%a in ('tlmgr --version') do (
		if "%%a"=="tlmgr using installation" (
			set texPath="%%b"&set texPath=!texPath:" =!
			set texPath=!texPath:"=!
		)
	)
	set texPath=!texPath!\texmf-dist\tex\latex\beamer\
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	texhash >nul 2>&1
) || call tlmgr --version 1>nul 2>&1 && (
	:: To-Do : MiKTeX
	set texPath=!texPath!\tex\latex\beamer\base\
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	initexmf --admin --update-fndb >nul
) || (
	cls&echo.&echo.&echo.&echo.&echo 請先安裝 MiKTeX, 再執行本安裝
	color E3&set /p=&goto exit
)

if !errorlevel!==1 (
	cls&echo.&echo.&echo.&echo.&echo 請先停止編譯 MiKTeX 專案, 再執行
	color 4C&set /p=&goto exit
)
cls&echo.&echo.&echo.&echo.&echo Install Theme Successful ^^!&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy /Y "%%c" "!texPath!!themesFile!" >nul
)

:exit

:: Copyright 2014 by SyneArt <sa@syneart.com>
@echo off&cls&title Install&color 0F&mode con cols=38 lines=10
setlocal enableextensions enabledelayedexpansion
echo.&echo.&echo.&echo.&echo Install Theme Now ..
set texPath=nul
REM TeXLive
call tlmgr --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=:" %%a in ('tlmgr --version') do (
		if "%%a"=="tlmgr using installation" (
			set texPath="%%b"&set texPath=!texPath:" =!
			set texPath=!texPath:"=!
		)
	)
	set texPath=!texPath!\texmf-dist\tex\latex\beamer\
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	texhash >nul 2>&1
REM MiKTeX
) || call initexmf --version 1>nul 2>&1 && (
	for /f "tokens=1* delims=:" %%a in ('initexmf --report') do (
		if "%%a"=="UserInstall" (
			set texPath="%%b"&set texPath=!texPath:" =!
			set texPath=!texPath:"=!
		)
	)
	set texPath=!texPath!\tex\latex\beamer\base\
	call:copyFile .\themes, *.sty&call:copyFile .\art, *.jpg
	initexmf --admin --update-fndb >nul
) || (
	cls&echo.&echo.&echo.&echo.&echo Please install LaTeX first.
	color E3&set /p=&goto exit
)

if !errorlevel!==1 (
	cls&echo.&echo.&echo.&echo.&echo Please stop LaTeX Compile first.
	color 4C&set /p=&goto exit
)
cls&echo.&echo.&echo.&echo.&echo Install Theme Successful ^^!&color 2A&ping 127.0.0.1 -n 3 >nul&goto exit

:copyFile
FOR /R %~1 %%c in (%~2) DO (
	set themesFile=%%c&set themesFile=!themesFile:%~dp0=!
	copy /Y "%%c" "!texPath!!themesFile!" >nul
)

:exit

Support TeXLive and MiKTeX now.

Support TeXLive and MiKTeX now.


@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install vagrant chefdk virtualbox visualstudiocode 7zip googlechrome notepadplusplus.install firefox git.install tortoisegit -y
refreshenv
vagrant plugin install vagrant-winrm
vagrant box add mwrock/Windows2016 --provider virtualbox
vagrant box add mwrock/Windows2012R2 --provider virtualbox
vagrant box add jacqinthebox/windowsserver2016core --provider virtualbox
code --install-extension ms-vscode.powershell
code --install-extension msazurermtools.azurerm-vscode-tools
code --install-extension HookyQR.beautify
code --install-extension Pendrica.chef
code --install-extension ms-vscode.PeterJausovec.vscode-docker
code --install-extension alefragnani.project-manager
code --install-extension Borke.puppet
code --install-extension mauve.terraform
code --install-extension bbenoist.vagrant
code --list-extensions
mkdir c:\github
cd c:\github
git clone https://github.com/iaingblack/Automation.git
chef gem install kitchen-all

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install googlechrome 7zip notepadplusplus.install firefox git.install tortoisegit vagrant chefdk virtualbox visualstudiocode -y
refreshenv
vagrant plugin install vagrant-winrm
vagrant box add mwrock/Windows2016 --provider virtualbox
vagrant box add mwrock/Windows2012R2 --provider virtualbox
vagrant box add jacqinthebox/windowsserver2016core --provider virtualbox
code --install-extension ms-vscode.powershell
code --install-extension msazurermtools.azurerm-vscode-tools
code --install-extension HookyQR.beautify
code --install-extension Pendrica.chef
code --install-extension ms-vscode.PeterJausovec.vscode-docker
code --install-extension alefragnani.project-manager
code --install-extension Borke.puppet
code --install-extension mauve.terraform
code --install-extension bbenoist.vagrant
code --list-extensions
mkdir c:\github
cd c:\github
git clone https://github.com/iaingblack/Automation.git
chef gem install kitchen-all

Install smaller things first, like chrome so can be used immediately


rem ------------------
rem AUTOCLEAN-PREP.BAT
rem ------------------

rem crappy to do list follows...
rem add test for techtemp
rem add test for null entries
rem add test for
rem add test for if Tron updated and copy back to BEAST overwriting old Tron
rem add test for network connectivity (eth & BEAST access)
rem ESC chars and color codes do not work in Win7 prompt

@echo off
:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------
    color 1f
    mode 90,35
	title TechTutor's Clean Up Script - Prep Stage

    SETLOCAL EnableDelayedExpansion

	cls

	set horiz_line=-
	set dash=-

	for /L %%i in (0,1,88) do (
		set horiz_line=-!horiz_line!
	)

	echo %horiz_line%
	echo TechTutor's Clean Up Script - Prep Stage
	echo %horiz_line%
	echo,

	set workingdir=c:%HOMEPATH%\Desktop\techtemp
	mkdir %workingdir%
	echo cd %workingdir%
	cd %workingdir%

	echo copy /y NUL autoclean-prep >NUL
	echo,

	copy /y NUL autoclean-prep >NUL
	pause

	:drivelettertest
	for %%d in (a b c d e f g h i j k l m n o p q r s t u v) do (if not exist %%d: echo Beast documents folder will be mapped to: %%d: & set "netletter=%%d:" & goto :netletter)

	:netletter
    for /f "skip=1 tokens=1-6 delims= " %%a in ('wmic path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
        IF NOT "%%~f"=="" (
            set /a FormattedDate=10000 * %%f + 100 * %%d + %%a
            set FormattedDate=!FormattedDate:~-0,4!-!FormattedDate:~-4,2!-!FormattedDate:~-2,2!
        )
    )

	:clientname
	echo,
	set input=
	set /p firstname="Client's first name: "
	set /p lastname="Client's Last name: "
	echo,
	:clientnameconfirm
	set /p input=You entered: %firstname% %lastname%. Is this correct? (y/n) %=%
	if /i %input%==y goto :clientnamegood
	if /i %input%==n goto :clientname
	echo Incorrect input. & goto :clientnameconfirm

	:clientnamegood

	:avira
	echo,
	set av=
	set /p av="Does the client need Avira installed? (y/n): "

	:aviraconfirm
	if /i %av%==y goto :aviraneeded
	if /i %av%==n goto :noavira
	echo Incorrect input. & goto :avira

	:aviraneeded
	set ninite=Ninite Avira Chrome Teamviewer 12 Installer.exe
	goto :netmap

	:noavira
	set ninite=Ninite Chrome Teamviewer 12 Installer.exe

	:netmap
	echo Mapping Beast Documents folder to drive letter %netletter%
	echo,

    echo net use %netletter% \\BEAST\Documents /user:techtutors *
	net use %netletter% \\BEAST\Documents /user:techtutors *
	echo Network drive mapped to %netletter%
	echo Creating clean up subdirectories for %firstname% %lastname% on the BEAST...
	echo,

	echo mkdir "%netletter%\Clean Up Logs\%lastname%-%firstname%-%FormattedDate%"
	mkdir "%netletter%\Clean Up Logs\%lastname%-%firstname%-%FormattedDate%"
	echo ...Done.
	echo,

	echo Dumping preclean system info...
	echo msinfo32 /nfo "%netletter%\Sysinfo Dumps\%lastname%-%firstname%-preclean-%FormattedDate%.nfo"
	msinfo32 /nfo "%netletter%\Sysinfo Dumps\%lastname%-%firstname%-preclean-%FormattedDate%.nfo"
	echo ...Done.
	echo,

	echo Copying automation files to %workingdir%
	echo ...Done.
	echo,
	robocopy /s "%netletter%\Automation\Clean Up" %workingdir%
	robocopy /s "%netletter%\Automation\Clean Up" %workingdir%

	echo Importing perfmon xml...
	echo logman import -n TT-CleanUp -xml CleanUp-Test.xml
	echo,
	logman import -n TT-CleanUp -xml CleanUp-Test.xml

    echo Starting Performance Monitor. Please wait...
	echo,

	echo logman start TT-CleanUp
	logman start TT-CleanUp

	echo Waiting for perfmon to finish...
    echo timeout 120
	timeout 120
	echo ...Done!
	echo,

	echo Launching PC Decrapifier
	echo START "" /WAIT "%workingdir%\pc-decrapifier.exe"
	START "" /WAIT "%workingdir%\pc-decrapifier.exe"
	echo,

	echo Launching ADWCLeaner
	echo START "" /WAIT "%workingdir%\Tron\tron\resources\stage_9_manual_tools\adwcleaner*.exe"
	START "" /WAIT "%workingdir%\Tron\tron\resources\stage_9_manual_tools\adwcleaner.exe"
	echo,

	if /i %av%==y echo Installing/updating Avira, Chrome, Teamviewer 12 else echo Installing/updating Chrome & Teamviewer 12
	echo START "" /WAIT "%workingdir%\%ninite%"
	START "" /WAIT "%workingdir%\%ninite%"
	echo,

	echo Adding next stage to Startup
	echo %workingdir%\autoclean-startclean.bat %lastname% %firstname% %FormattedDate%>"C:%HOMEPATH%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\autoclean-startcleantemp.bat
	rem echo Adding startclean batch file to RunOnce registry key
	rem echo REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v AutoClean-StartClean /t REG_EXPAND_SZ /d "%workingdir%\autoclean-startclean.bat %lastname% %firstname% %FormattedDate%"
	rem REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v AutoClean-StartClean /t REG_EXPAND_SZ /d "%workingdir%\autoclean-startclean.bat %lastname% %firstname% %FormattedDate%"

	echo Starting BootTimer. Prepare for reboot...
	%workingdir%/boottimer.exe

	rem Removing autoclean-start flag file
	echo del autoclean-prep
	echo,
	del autoclean-prep
	rem NOTE: Need to check how to automatically log the number that gets presented in the BootTimer dialogue. (Does it output to STDERR?)

 	rem -I don't think this code is necessary as Windows will just release upon reboot anyway - echo net use %netletter% /delete
	rem net use %netletter% /delete
	pause

rem ------------------
rem AUTOCLEAN-PREP.BAT
rem ------------------

rem crappy to do list follows...
rem add test for techtemp
rem add test for null entries
rem add test for
rem add test for if Tron updated and copy back to BEAST overwriting old Tron
rem add test for network connectivity (eth & BEAST access)
rem ESC chars and color codes do not work in Win7 prompt

@echo off
:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------
    color 1f
    mode 90,35
	title TechTutor's Clean Up Script - Prep Stage

    SETLOCAL EnableDelayedExpansion

	cls

	set horiz_line=-
	set dash=-

	for /L %%i in (0,1,88) do (
		set horiz_line=-!horiz_line!
	)

	echo %horiz_line%
	echo TechTutor's Clean Up Script - Prep Stage
	echo %horiz_line%
	echo,

	set workingdir=c:%HOMEPATH%\Desktop\techtemp
	mkdir %workingdir%
	echo cd %workingdir%
	cd %workingdir%

	echo copy /y NUL autoclean-prep >NUL
	echo,

	copy /y NUL autoclean-prep >NUL
	pause

	:drivelettertest
	for %%d in (a b c d e f g h i j k l m n o p q r s t u v) do (if not exist %%d: echo Beast documents folder will be mapped to: %%d: & set "netletter=%%d:" & goto :netletter)

	:netletter
    for /f "skip=1 tokens=1-6 delims= " %%a in ('wmic path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
        IF NOT "%%~f"=="" (
            set /a FormattedDate=10000 * %%f + 100 * %%d + %%a
            set FormattedDate=!FormattedDate:~-0,4!-!FormattedDate:~-4,2!-!FormattedDate:~-2,2!
        )
    )

	:clientname
	echo,
	set input=
	set /p firstname="Client's first name: "
	set /p lastname="Client's Last name: "
	echo,
	:clientnameconfirm
	set /p input=You entered: %firstname% %lastname%. Is this correct? (y/n) %=%
	if /i %input%==y goto :clientnamegood
	if /i %input%==n goto :clientname
	echo Incorrect input. & goto :clientnameconfirm

	:clientnamegood

	:avira
	echo,
	set av=
	set /p av="Does the client need Avira installed? (y/n): "

	:aviraconfirm
	if /i %av%==y goto :aviraneeded
	if /i %av%==n goto :noavira
	echo Incorrect input. & goto :avira

	:aviraneeded
	set ninite=Ninite Avira Chrome Teamviewer 12 Installer.exe
	goto :netmap

	:noavira
	set ninite=Ninite Chrome Teamviewer 12 Installer.exe

	:netmap
	echo Mapping Beast Documents folder to drive letter %netletter%
	echo,

    echo net use %netletter% \\BEAST\Documents /user:techtutors *
	net use %netletter% \\BEAST\Documents /user:techtutors *
	echo Network drive mapped to %netletter%
	echo Creating clean up subdirectories for %firstname% %lastname% on the BEAST...
	echo,

	echo mkdir "%netletter%\Clean Up Logs\%lastname%-%firstname%-%FormattedDate%"
	mkdir "%netletter%\Clean Up Logs\%lastname%-%firstname%-%FormattedDate%"
	echo ...Done.
	echo,

	echo Dumping preclean system info...
	echo msinfo32 /nfo "%netletter%\Sysinfo Dumps\%lastname%-%firstname%-preclean-%FormattedDate%.nfo"
	msinfo32 /nfo "%netletter%\Sysinfo Dumps\%lastname%-%firstname%-preclean-%FormattedDate%.nfo"
	echo ...Done.
	echo,

	echo Copying automation files to %workingdir%
	echo ...Done.
	echo,
	robocopy /s "%netletter%\Automation\Clean Up" %workingdir%
	robocopy /s "%netletter%\Automation\Clean Up" %workingdir%

	echo Importing perfmon xml...
	echo logman import -n TT-CleanUp -xml CleanUp-Test.xml
	echo,
	logman import -n TT-CleanUp -xml CleanUp-Test.xml

    echo Starting Performance Monitor. Please wait...
	echo,

	echo logman start TT-CleanUp
	logman start TT-CleanUp

	echo Waiting for perfmon to finish...
    echo timeout 120
	timeout 120
	echo ...Done!
	echo,

	echo Launching PC Decrapifier
	echo START "" /WAIT "%workingdir%\pc-decrapifier.exe"
	START "" /WAIT "%workingdir%\pc-decrapifier.exe"
	echo,

	echo Launching ADWCLeaner
	echo START "" /WAIT "%workingdir%\Tron\tron\resources\stage_9_manual_tools\adwcleaner*.exe"
	START "" /WAIT "%workingdir%\Tron\tron\resources\stage_9_manual_tools\adwcleaner*.exe"
	echo,

	if /i %av%==y echo Installing/updating Avira, Chrome, Teamviewer 12 else echo Installing/updating Chrome & Teamviewer 12
	echo START "" /WAIT "%workingdir%\%ninite%"
	START "" /WAIT "%workingdir%\%ninite%"
	echo,

	echo Adding next stage to Startup
	echo %workingdir%\autoclean-startclean.bat %lastname% %firstname% %FormattedDate%>"C:%HOMEPATH%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\autoclean-startcleantemp.bat
	rem echo Adding startclean batch file to RunOnce registry key
	rem echo REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v AutoClean-StartClean /t REG_EXPAND_SZ /d "%workingdir%\autoclean-startclean.bat %lastname% %firstname% %FormattedDate%"
	rem REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v AutoClean-StartClean /t REG_EXPAND_SZ /d "%workingdir%\autoclean-startclean.bat %lastname% %firstname% %FormattedDate%"

	echo Starting BootTimer. Prepare for reboot...
	%workingdir%/boottimer.exe

	rem Removing autoclean-start flag file
	echo del autoclean-prep
	echo,
	del autoclean-prep
	rem NOTE: Need to check how to automatically log the number that gets presented in the BootTimer dialogue. (Does it output to STDERR?)

 	rem -I don't think this code is necessary as Windows will just release upon reboot anyway - echo net use %netletter% /delete
	rem net use %netletter% /delete
	pause

Fix dumb mistake

Fix dumb mistake


@echo off
SET INNOSETUP=%CD%\nvm.iss
SET ORIG=%CD%
REM SET GOPATH=%CD%\src
SET GOBIN=%CD%\bin
REM Support for older architectures
SET GOARCH=386

REM Cleanup existing build if it exists
if exist src\nvm.exe (
  del src\nvm.exe
)

REM Make the executable and add to the binary directory
echo Building nvm.exe
go build src\nvm.go

REM Group the file with the helper binaries
move nvm.exe %GOBIN%

REM Codesign the executable
.\buildtools\signtools\x64\signtool.exe sign /debug /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a %GOBIN%\nvm.exe

for /f %%i in ('%GOBIN%\nvm.exe version') do set AppVersion=%%i
echo nvm.exe v%AppVersion% built.

REM Create the distribution folder
SET DIST=%CD%\dist\%AppVersion%

REM Remove old build files if they exist.
if exist %DIST% (
  echo Clearing old build in %DIST%
  rd /s /q "%DIST%"
)

REM Create the distribution directory
mkdir "%DIST%"

REM Create the "no install" zip version
for %%a in (%GOBIN%) do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" "%%a\*" -x "%GOBIN%\nodejs.ico")

REM Generate the installer (InnoSetup)
buildtools\iscc %INNOSETUP% /o%DIST%
buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe"

REM Generate checksums
for %%f in (%DIST%\*.*) do (certutil -hashfile "%%f" MD5 | find /i /v "md5" | find /i /v "certutil" >> "%%f.checksum.txt")

REM Cleanup
del %GOBIN%\nvm.exe

echo NVM for Windows v%AppVersion% build completed.
@echo on

@echo off
SET INNOSETUP=%CD%\nvm.iss
SET ORIG=%CD%
REM SET GOPATH=%CD%\src
SET GOBIN=%CD%\bin
REM Support for older architectures
SET GOARCH=386

REM Cleanup existing build if it exists
if exist src\nvm.exe (
  del src\nvm.exe
)

REM Make the executable and add to the binary directory
echo Building nvm.exe
go build src\nvm.go

REM Group the file with the helper binaries
move nvm.exe "%GOBIN%"

REM Codesign the executable
.\buildtools\signtools\x64\signtool.exe sign /debug /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a "%GOBIN%\nvm.exe"

for /f %%i in ('"%GOBIN%\nvm.exe" version') do set AppVersion=%%i
echo nvm.exe v%AppVersion% built.

REM Create the distribution folder
SET DIST=%CD%\dist\%AppVersion%

REM Remove old build files if they exist.
if exist %DIST% (
  echo Clearing old build in %DIST%
  rd /s /q "%DIST%"
)

REM Create the distribution directory
mkdir "%DIST%"

REM Create the "no install" zip version
for %%a in ("%GOBIN%") do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" %%a\* -x "%GOBIN%\nodejs.ico")

REM Generate the installer (InnoSetup)
buildtools\iscc "%INNOSETUP%" "/o%DIST%"
buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe"

REM Generate checksums
for %%f in (%DIST%\*.*) do (certutil -hashfile "%%f" MD5 | find /i /v "md5" | find /i /v "certutil" >> "%%f.checksum.txt")

REM Cleanup
del %GOBIN%\nvm.exe

echo NVM for Windows v%AppVersion% build completed.
@echo on

Fix build when PATH contains spaces

Fix build when PATH contains spaces


@echo off
setlocal enabledelayedexpansion

SET solution_name=Theraot.sln

SET build_configuration=NET20 NET30 NET35 NET40 NET45
SET assemblies=Theraot.Core.dll
SET recovery_path=Core\bin
SET spec_file=Theraot.nuspec

REM USE QUOTES ALWAYS <----
SET msbuild_fallback="C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"

echo.
echo Starting.
echo.

for /f "tokens=*" %%a in (%1) do (

   set write=%%a
   if %%a==%findthis% set write=%replacewith%

   echo !write!
   echo !write! >>%~n1.replaced%~x1
)

SET mypath=%~dp0
echo Running build.cmd from %mypath:~0,-1%

echo Looking for MSBuild in PATH

for %%X in (MSBuild.exe) do (SET FOUND_A=%%~$PATH:X)
if defined FOUND_A (
	echo MSBuild.exe is in PATH
	SET msbuild=%FOUND_A%
) ELSE (
	echo MSBuild.exe is in not in PATH
	echo Fallback to default MSBuild.exe location
	SET msbuild=%msbuild_fallback%
	echo Looking for MSBuild in: %msbuild_fallback%
)

if EXIST %msbuild:~1,-1% (
	echo MSBuild found.

	SET solution=%mypath:~0,-1%\%solution_name%
	echo Looking Solution file: %solution%

	IF EXIST %solution% (
		echo Solution file found.

		echo.
		echo Building.
		echo.
		@echo on
		@for %%A in (%build_configuration%) do (
			%msbuild% %solution% /m /p:Configuration=%%A
		)
		@echo off

		if not EXIST %mypath:~0,-1%\%spec_file% (
			popd
			exit
		)

		echo.
		echo Recovering assemblies.
		echo.

		@echo on

		pushd %~dp0
		cd /D %mypath:~0,3%
		cd %mypath%

		rmdir /S /Q package
		mkdir package
		mkdir package\lib\

		copy %spec_file% package\%spec_file%

		@for %%A in (%build_configuration%) do (
			mkdir package\lib\%%A\
			@for %%B in (%assemblies%) do (
				copy %recovery_path%\%%A\%%B package\lib\%%A\%%B
			)
		)
		@echo off

		echo Looking for NuGet in PATH

		for %%X in (NuGet.exe) do (SET FOUND_B=%%~$PATH:X)
		if defined FOUND_B (
			echo NuGet.exe is in PATH
			SET nuget=%FOUND_B%
		) ELSE (
			echo NuGet.exe is in not in PATH
			echo Fallback to NuGet.CommandLine
			pushd %~dp0
			cd /D %mypath:~0,3%
			cd %mypath:~0,-1%\packages\
			for /D %%s in (.\*) do (
				SET folder=%%s
				SET folder=!folder:~2,17!
				if "!folder!" == "NuGet.CommandLine" (
					SET folder=%%s
					SET nuget=%mypath:~0,-1%\packages\!folder:~2!\tools\NuGet.exe
					SET dst_folder=%mypath:~0,-1%\packages\!folder:~2!\tools\
				)
			)
			popd
			echo Looking for NuGet.exe in: !nuget!
		)

		if EXIST version.txt (
			SET /P version=<version.txt
			for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
			set today=!MyDate:~0,4!!MyDate:~4,2!!MyDate:~6,2!
			SET version=!version!-pre!today!
			SET version=-Version !version!
		)

		popd

		if EXIST !nuget! (
			pushd %~dp0
			cd !dst_folder!
			.\NuGet.exe pack %mypath:~0,-1%\package\%spec_file% -OutputDirectory %mypath:~0,-1%\package\ !version!
			popd
			exit
		) ELSE (
			echo NuGet.exe not found.
			exit
		)
	) ELSE (
		echo Solution file not found.
		exit
	)
) ELSE (
	echo MSBuild.exe not found.
	exit
)

@echo off
setlocal enabledelayedexpansion

SET solution_name=Theraot.sln

SET build_configuration=NET20 NET30 NET35 NET40 NET45
SET assemblies=Theraot.Core.dll
SET recovery_path=Core\bin
SET spec_file=Theraot.nuspec

REM USE QUOTES ALWAYS <----
SET msbuild_fallback="C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"

echo.
echo Starting.
echo.

SET mypath=%~dp0
echo Running build.cmd from %mypath:~0,-1%

echo Looking for MSBuild in PATH

for %%X in (MSBuild.exe) do (SET FOUND_A=%%~$PATH:X)
if defined FOUND_A (
	echo MSBuild.exe is in PATH
	SET msbuild=%FOUND_A%
) ELSE (
	echo MSBuild.exe is in not in PATH
	echo Fallback to default MSBuild.exe location
	SET msbuild=%msbuild_fallback%
	echo Looking for MSBuild in: %msbuild_fallback%
)

if EXIST %msbuild:~1,-1% (
	echo MSBuild found.

	SET solution=%mypath:~0,-1%\%solution_name%
	echo Looking Solution file: %solution%

	IF EXIST %solution% (
		echo Solution file found.

		echo.
		echo Building.
		echo.
		@echo on
		@for %%A in (%build_configuration%) do (
			%msbuild% %solution% /m /p:Configuration=%%A
		)
		@echo off

		if not EXIST %mypath:~0,-1%\%spec_file% (
			popd
			exit
		)

		echo.
		echo Recovering assemblies.
		echo.

		@echo on

		pushd %~dp0
		cd /D %mypath:~0,3%
		cd %mypath%

		rmdir /S /Q package
		mkdir package
		mkdir package\lib\

		copy %spec_file% package\%spec_file%

		@for %%A in (%build_configuration%) do (
			mkdir package\lib\%%A\
			@for %%B in (%assemblies%) do (
				copy %recovery_path%\%%A\%%B package\lib\%%A\%%B
			)
		)
		@echo off

		echo Looking for NuGet in PATH

		for %%X in (NuGet.exe) do (SET FOUND_B=%%~$PATH:X)
		if defined FOUND_B (
			echo NuGet.exe is in PATH
			SET nuget=%FOUND_B%
		) ELSE (
			echo NuGet.exe is in not in PATH
			echo Fallback to NuGet.CommandLine
			pushd %~dp0
			cd /D %mypath:~0,3%
			cd %mypath:~0,-1%\packages\
			for /D %%s in (.\*) do (
				SET folder=%%s
				SET folder=!folder:~2,17!
				if "!folder!" == "NuGet.CommandLine" (
					SET folder=%%s
					SET nuget=%mypath:~0,-1%\packages\!folder:~2!\tools\NuGet.exe
					SET dst_folder=%mypath:~0,-1%\packages\!folder:~2!\tools\
				)
			)
			popd
			echo Looking for NuGet.exe in: !nuget!
		)

		if EXIST version.txt (
			SET /P version=<version.txt
			for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
			set today=!MyDate:~0,4!!MyDate:~4,2!!MyDate:~6,2!
			SET version=!version!-pre!today!
			SET version=-Version !version!
		)

		popd

		if EXIST !nuget! (
			pushd %~dp0
			cd !dst_folder!
			.\NuGet.exe pack %mypath:~0,-1%\package\%spec_file% -OutputDirectory %mypath:~0,-1%\package\ !version!
			popd
			exit
		) ELSE (
			echo NuGet.exe not found.
			exit
		)
	) ELSE (
		echo Solution file not found.
		exit
	)
) ELSE (
	echo MSBuild.exe not found.
	exit
)

Build script fix v_v

Build script fix v_v


@echo off
setlocal
call "%VS120COMNTOOLS%\VsDevCmd.bat"
msbuild .\PSScriptAnalyzer.sln
if NOT [%ERRORLEVEL%]==[0] pause
endlocal

@echo off
setlocal
if "%VS120COMNTOOLS%"=="" GOTO NOTOOLS
call "%VS120COMNTOOLS%\VsDevCmd.bat"
msbuild .\PSScriptAnalyzer.sln
if NOT [%ERRORLEVEL%]==[0] pause

GOTO END

:NOTOOLS
echo The Visual Studio 2012 tools are not installed
pause

:END
endlocal

Check for VS Build tools

Check for VS Build tools


@echo off
if not exist packages\FAKE\tools\Fake.exe (
  .nuget\nuget.exe install FAKE -OutputDirectory packages -ExcludeVersion -Prerelease
)
packages\FAKE\tools\FAKE.exe build.fsx %*
pause

Remove pause command from build.cmd

Remove pause command from build.cmd


@echo off
setlocal EnableDelayedExpansion

:: Set the default arguments for build
set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

:: Default to VS2013
set __VSVersion=VS2013
set __VSProductVersion=120

:: Set the various build properties here so that CMake and MSBuild can pick them up
set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__ProjectFilesDir=%__ProjectDir%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
set __MSBCleanBuildArgs=

:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "/?" goto Usage
if /i "%1" == "x64"    (set __BuildArch=x64&&shift&goto Arg_Loop)

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"   (set __BuildType=Release&shift&goto Arg_Loop)

if /i "%1" == "clean"   (set __CleanBuild=1&shift&goto Arg_Loop)

if /i "%1" == "linuxmscorlib" (set __MscorlibOnly=1&set __BuildOS=Linux&shift&goto Arg_Loop)
if /i "%1" == "osxmscorlib" (set __MscorlibOnly=1&set __BuildOS=OSX&shift&goto Arg_Loop)

if /i "%1" == "vs2013" (set __VSVersion=%1&set __VSProductVersion=120&shift&goto Arg_Loop)
if /i "%1" == "vs2015" (set __VSVersion=%1&set __VSProductVersion=140&shift&goto Arg_Loop)

echo Invalid commandline argument: %1
goto Usage

:ArgsDone

echo Commencing CoreCLR Repo build
echo.

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__PackagesBinDir=%__BinDir%\.nuget"
set "__ToolsDir=%__RootBinDir%\tools"
set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__TestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"

:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.

:: MSBuild projects would need a rebuild
set __MSBCleanBuildArgs=/t:rebuild

:: Cleanup the previous output for the selected configuration
if exist "%__BinDir%" rd /s /q "%__BinDir%"
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"

if exist "%__TestBinDir%" rd /s /q "%__TestBinDir%"
if exist "%__TestIntermediatesDir%" rd /s /q "%__TestIntermediatesDir%"

if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*"

:MakeDirs
if not exist "%__BinDir%" md "%__BinDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"

:: CMake isn't a requirement when building mscorlib only
if defined __MscorlibOnly goto CheckVS

:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a

goto CheckVS

:CheckVS
:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence
echo Visual Studio 2013 Community (free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/developer-guide.md#prerequisites
exit /b 1

:CheckVSExistence
:: Does VS 2013 or VS 2015 really exist?
if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild
echo Visual Studio 2013 Community (free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/developer-guide.md#prerequisites
exit /b 1

:CheckMSBuild
:: Note: We've disabled node reuse because it causes file locking issues.
::       The issue is that we extend the build with our own targets which
::       means that that rebuilding cannot successfully delete the task
::       assembly.
if /i "%__VSVersion%" =="vs2015" goto MSBuild14
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
goto :CheckMSBuild14
:MSBuild14
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
set UseRoslynCompiler=true
:CheckMSBuild14
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/coreclr/blob/master/developer-guide.md for build instructions. && exit /b 1

:: All set to commence the build

setlocal
if defined __MscorlibOnly goto PerformMScorlibBuild

echo Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.

:: Set the environment for the native build
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" x86_amd64

if exist "%VSINSTALLDIR%DIA SDK" goto GenVSSolution
echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
at VS install location of previous version. Workaround is to copy DIA SDK folder from VS install location ^
of previous version to "%VSINSTALLDIR%" and then resume build.
:: DIA SDK not included in Express editions
echo Visual Studio 2013 Express does not include the DIA SDK. ^
You need Visual Studio 2013 Community (free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/developer-guide.md#prerequisites
exit /b 1

:GenVSSolution
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion%
popd

:BuildComponents
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildCoreCLR
echo Failed to generate native component build project!
exit /b 1

REM Build CoreCLR
:BuildCoreCLR
set "__CoreCLRBuildLog=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__IntermediatesDir%\install.vcxproj" %__MSBCleanBuildArgs% /nologo /maxcpucount /nodeReuse:false /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% /fileloggerparameters:Verbosity=diag;LogFile="%__CoreCLRBuildLog%"
IF NOT ERRORLEVEL 1 goto PerformMScorlibBuild
echo Native component build failed. Refer !__CoreCLRBuildLog! for details.
exit /b 1

:PerformMScorlibBuild
REM endlocal to rid us of environment changes from vcvarsall.bat
endlocal

REM setlocal to prepare for vsdevcmd.bat
setlocal
set __AdditionalMSBuildArgs=

rem Explicitly set Platform causes conflicts in mscorlib project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=

if defined __MscorlibOnly set __AdditionalMSBuildArgs=/p:BuildNugetPackage=false

:: Set the environment for the managed build
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of mscorlib for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__MScorlibBuildLog=%__LogsDir%\MScorlib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__ProjectFilesDir%\build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%__MScorlibBuildLog%" /p:OS=%__BuildOS% %__AdditionalMSBuildArgs%
IF NOT ERRORLEVEL 1 (
  if defined __MscorlibOnly exit /b 0
  goto CrossGenMscorlib
)

echo MScorlib build failed. Refer !__MScorlibBuildLog! for details.
exit /b 1

:CrossGenMscorlib
echo Generating native image of mscorlib for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__CrossGenMScorlibLog=%__LogsDir%\CrossgenMScorlib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%__BinDir%\crossgen.exe %__BinDir%\mscorlib.dll > "%__CrossGenMScorlibLog%" 2>&1
IF NOT ERRORLEVEL 1 (
  goto PerformTestBuild
)

echo CrossGen mscorlib failed. Refer !__CrossGenMScorlibLog! for details.
exit /b 1

:PerformTestBuild
echo.
echo Commencing build of tests for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
call tests\buildtest.cmd
IF NOT ERRORLEVEL 1 goto SuccessfulBuild
echo Test binaries build failed. Refer !__MScorlibBuildLog! for details.
exit /b 1

:SuccessfulBuild
::Build complete
echo Repo successfully built.
echo.
echo Product binaries are available at !__BinDir!
echo Test binaries are available at !__TestBinDir!
exit /b 0

:Usage
echo.
echo Usage:
echo %0 BuildArch BuildType [clean] [vsversion] where:
echo.
echo BuildArch can be: x64
echo BuildType can be: Debug, Release
echo Clean - optional argument to force a clean build.
echo VSVersion - optional argument to use VS2013 or VS2015 (default VS2013)
echo linuxmscorlib - Build mscorlib for Linux
echo osxmscorlib - Build mscorlib for OS X
exit /b 1

@echo off
setlocal EnableDelayedExpansion

:: Set the default arguments for build
set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

:: Default to VS2013
set __VSVersion=VS2013
set __VSProductVersion=120

:: Set the various build properties here so that CMake and MSBuild can pick them up
set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__ProjectFilesDir=%__ProjectDir%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
set __MSBCleanBuildArgs=

:Arg_Loop
if "%1" == "" goto ArgsDone
if /i "%1" == "/?" goto Usage
if /i "%1" == "x64"    (set __BuildArch=x64&&shift&goto Arg_Loop)

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"   (set __BuildType=Release&shift&goto Arg_Loop)

if /i "%1" == "clean"   (set __CleanBuild=1&shift&goto Arg_Loop)

if /i "%1" == "windowsmscorlib" (set __MscorlibOnly=1&set __BuildOS=Windows_NT&shift&goto Arg_Loop)
if /i "%1" == "linuxmscorlib" (set __MscorlibOnly=1&set __BuildOS=Linux&shift&goto Arg_Loop)
if /i "%1" == "osxmscorlib" (set __MscorlibOnly=1&set __BuildOS=OSX&shift&goto Arg_Loop)

if /i "%1" == "vs2013" (set __VSVersion=%1&set __VSProductVersion=120&shift&goto Arg_Loop)
if /i "%1" == "vs2015" (set __VSVersion=%1&set __VSProductVersion=140&shift&goto Arg_Loop)

echo Invalid commandline argument: %1
goto Usage

:ArgsDone

echo Commencing CoreCLR Repo build
echo.

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__PackagesBinDir=%__BinDir%\.nuget"
set "__ToolsDir=%__RootBinDir%\tools"
set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__TestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"

:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.

:: MSBuild projects would need a rebuild
set __MSBCleanBuildArgs=/t:rebuild

:: Cleanup the previous output for the selected configuration
if exist "%__BinDir%" rd /s /q "%__BinDir%"
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"

if exist "%__TestBinDir%" rd /s /q "%__TestBinDir%"
if exist "%__TestIntermediatesDir%" rd /s /q "%__TestIntermediatesDir%"

if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*"

:MakeDirs
if not exist "%__BinDir%" md "%__BinDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"

:: CMake isn't a requirement when building mscorlib only
if defined __MscorlibOnly goto CheckVS

:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a

goto CheckVS

:CheckVS
:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence
echo Visual Studio 2013 Community (free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/developer-guide.md#prerequisites
exit /b 1

:CheckVSExistence
:: Does VS 2013 or VS 2015 really exist?
if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild
echo Visual Studio 2013 Community (free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/developer-guide.md#prerequisites
exit /b 1

:CheckMSBuild
:: Note: We've disabled node reuse because it causes file locking issues.
::       The issue is that we extend the build with our own targets which
::       means that that rebuilding cannot successfully delete the task
::       assembly.
if /i "%__VSVersion%" =="vs2015" goto MSBuild14
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
goto :CheckMSBuild14
:MSBuild14
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
set UseRoslynCompiler=true
:CheckMSBuild14
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/coreclr/blob/master/developer-guide.md for build instructions. && exit /b 1

:: All set to commence the build

setlocal
if defined __MscorlibOnly goto PerformMScorlibBuild

echo Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.

:: Set the environment for the native build
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" x86_amd64

if exist "%VSINSTALLDIR%DIA SDK" goto GenVSSolution
echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
at VS install location of previous version. Workaround is to copy DIA SDK folder from VS install location ^
of previous version to "%VSINSTALLDIR%" and then resume build.
:: DIA SDK not included in Express editions
echo Visual Studio 2013 Express does not include the DIA SDK. ^
You need Visual Studio 2013 Community (free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/developer-guide.md#prerequisites
exit /b 1

:GenVSSolution
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion%
popd

:BuildComponents
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildCoreCLR
echo Failed to generate native component build project!
exit /b 1

REM Build CoreCLR
:BuildCoreCLR
set "__CoreCLRBuildLog=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__IntermediatesDir%\install.vcxproj" %__MSBCleanBuildArgs% /nologo /maxcpucount /nodeReuse:false /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% /fileloggerparameters:Verbosity=diag;LogFile="%__CoreCLRBuildLog%"
IF NOT ERRORLEVEL 1 goto PerformMScorlibBuild
echo Native component build failed. Refer !__CoreCLRBuildLog! for details.
exit /b 1

:PerformMScorlibBuild
REM endlocal to rid us of environment changes from vcvarsall.bat
endlocal

REM setlocal to prepare for vsdevcmd.bat
setlocal
set __AdditionalMSBuildArgs=

rem Explicitly set Platform causes conflicts in mscorlib project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=

if defined __MscorlibOnly set __AdditionalMSBuildArgs=/p:BuildNugetPackage=false

:: Set the environment for the managed build
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of mscorlib for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__MScorlibBuildLog=%__LogsDir%\MScorlib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__ProjectFilesDir%\build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%__MScorlibBuildLog%" /p:OS=%__BuildOS% %__AdditionalMSBuildArgs%
IF NOT ERRORLEVEL 1 (
  if defined __MscorlibOnly exit /b 0
  goto CrossGenMscorlib
)

echo MScorlib build failed. Refer !__MScorlibBuildLog! for details.
exit /b 1

:CrossGenMscorlib
echo Generating native image of mscorlib for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__CrossGenMScorlibLog=%__LogsDir%\CrossgenMScorlib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%__BinDir%\crossgen.exe %__BinDir%\mscorlib.dll > "%__CrossGenMScorlibLog%" 2>&1
IF NOT ERRORLEVEL 1 (
  goto PerformTestBuild
)

echo CrossGen mscorlib failed. Refer !__CrossGenMScorlibLog! for details.
exit /b 1

:PerformTestBuild
echo.
echo Commencing build of tests for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
call tests\buildtest.cmd
IF NOT ERRORLEVEL 1 goto SuccessfulBuild
echo Test binaries build failed. Refer !__MScorlibBuildLog! for details.
exit /b 1

:SuccessfulBuild
::Build complete
echo Repo successfully built.
echo.
echo Product binaries are available at !__BinDir!
echo Test binaries are available at !__TestBinDir!
exit /b 0

:Usage
echo.
echo Usage:
echo %0 BuildArch BuildType [clean] [vsversion] where:
echo.
echo BuildArch can be: x64
echo BuildType can be: Debug, Release
echo Clean - optional argument to force a clean build.
echo VSVersion - optional argument to use VS2013 or VS2015 (default VS2013)
echo windowsmscorlib - Build mscorlib for Windows
echo linuxmscorlib - Build mscorlib for Linux
echo osxmscorlib - Build mscorlib for OS X
exit /b 1

Add windowsmscorlib option to build.cmd

Add windowsmscorlib option to build.cmd


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.1/4542065/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.0.26/VBoxGuestAdditions_5.0.26.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.1/4542065/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.1.8/VBoxGuestAdditions_5.1.8.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

Update VirtualBox guest additions 5.1.8

Update VirtualBox guest additions 5.1.8


@echo off
SETLOCAL
PUSHD %~dp0

.paket\paket.bootstrapper.exe
if errorlevel 1 (
  exit /b %errorlevel%
)

.paket\paket.exe restore --group Build
if errorlevel 1 (
  exit /b %errorlevel%
)

SET FSI_PATH=packages\build\FAKE\tools\Fake.exe
"%FSI_PATH%" "build.fsx" Dummy --fsiargs build.fsx --shadowcopyreferences+ %*

@echo off
SETLOCAL
PUSHD %~dp0

.paket\paket.bootstrapper.exe
if errorlevel 1 (
  exit /b %errorlevel%
)

if NOT exist paket.lock (
    echo No paket.lock found, running paket install.
    .paket\paket.exe install
)

.paket\paket.exe restore --group Build
if errorlevel 1 (
  exit /b %errorlevel%
)

SET FSI_PATH=packages\build\FAKE\tools\Fake.exe
"%FSI_PATH%" "build.fsx" Dummy --fsiargs build.fsx --shadowcopyreferences+ %*

build cmd checks paket.lock

build cmd checks paket.lock


java -jar AndResGuard-cli-1.1.0.jar input.apk -config config.xml -out outapk -signature release.keystore testres testres testres
pause

set jdkpath=D:\Program Files\Java\jdk1.7.0_79\bin\java.exe
set storepath=release.keystore
set storepass=testres
set keypass=testres
set alias=testres
set zipalign=D:\soft\dev\android\sdk\build-tools\23.0.2\zipalign.exe
"%jdkpath%" -jar AndResGuard-cli-1.1.0.jar input.apk -config config.xml -out outapk -signature "%storepath%" "%storepass%" "%keypass%" "%alias%" -zipalign "%zipalign%"
pause

Update buildApk.bat

Update buildApk.bat

1、解决电脑安装了jdk6无法运行的问题，需要指定jdk7以上路径。
2、解决了原示例中没有zipalign会报错。并且提示的zipalign和后面的路径需要有空格。
3、做成了声明形式，方便大家调用吧。


c:\python25\python.exe setup.py install
c:\python25\python.exe setup.py bdist_wininst
c:\python25\python.exe setup.py sdist --formats=gztar,zip
copy dist\*.* \\ironpaw\pub\jasons\arcrest
cd documentation
createdocs.bat
cd ..
copy documentation\html\*.* \\ironpaw\pub\jasons\arcrest\documentation\
python mergeifneeded.py
hg history > \\ironpaw\pub\jasons\arcrest\changelog.txt
unix2dos \\ironpaw\pub\jasons\arcrest\changelog.txt
del \\ironpaw\pub\jasons\arcrest\*.bak

c:\python25\python.exe setup.py install
c:\python25\python.exe setup.py bdist_wininst
c:\python25\python.exe setup.py sdist --formats=gztar,zip
copy dist\*.* \\ironpaw\pub\jasons\arcrest
copy documentation\html\*.* \\ironpaw\pub\jasons\arcrest\documentation\
python mergeifneeded.py
hg history > \\ironpaw\pub\jasons\arcrest\changelog.txt
unix2dos \\ironpaw\pub\jasons\arcrest\changelog.txt
del \\ironpaw\pub\jasons\arcrest\*.bak

build update

build update


@ECHO OFF

rem call version.bat
%windir%\Microsoft.Net\Framework\v4.0.30319\msbuild ArachNGIN.sln /m /property:Configuration=Debug /property:Platform="Any CPU"
%windir%\Microsoft.Net\Framework\v4.0.30319\msbuild ArachNGIN.sln /m /property:Configuration=Release /property:Platform="Any CPU"

if ERRORLEVEL 1 pause

call gitversioner.bat w zip.bat
call zip.bat
call gitversioner.bat r zip.bat

@ECHO OFF

rem call version.bat
rem %windir%\Microsoft.Net\Framework\v4.0.30319\
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
msbuild ArachNGIN.sln /m /property:Configuration=Debug /property:Platform="Any CPU"
%windir%\Microsoft.Net\Framework\v4.0.30319\msbuild ArachNGIN.sln /m /property:Configuration=Release /property:Platform="Any CPU"

if ERRORLEVEL 1 pause

call gitversioner.bat w zip.bat
call zip.bat
call gitversioner.bat r zip.bat

use msbuild from visual studio 2015

build.bat: use msbuild from visual studio 2015


@SETLOCAL
@IF NOT EXIST .build mkdir .build
cd .build
cmake -Werror=dev -Werror=deprecated %~dp0
cmake --build . -- /verbosity:minimal
ctest

@SETLOCAL
@IF NOT EXIST .build mkdir .build
cd .build
cmake -Werror=dev -Werror=deprecated "%~dp0"
cmake --build . -- /verbosity:minimal
ctest

make build.cmd with spaces in the path

make build.cmd with spaces in the path


@ECHO OFF
SETLOCAL

REM Uncomment to forcibly set the build version.
REM set FORCE_VERSION=0.0.4-alpha4

IF NOT DEFINED DevEnvDir (
    IF DEFINED vs120comntools (
        set envsetup=call "%vs120comntools%\..\..\VC\vcvarsall.bat"
    ) else (
        echo "VS120COMNTOOLS is not defined, aborting."
        exit /b 1
    )
)

rem Install additional libraries (vc_mbcsmfc + boost.regex)
powershell -file install-dependencies.ps1

rem Restore NuGet packages
nuget restore source\BugTrap.vs2013.sln

rem Add boost to include and library paths
set "INCLUDE=C:\Libraries\boost;%INCLUDE%"
set "LIB=C:\Libraries\boost\stage\lib;%LIB%"

rem Additional arguments required for msbuild to use INCLUDE and LIB
set "MSB_ADD_ARGS=-p:useenv=true"

rem 32-bit client
%envsetup% x86

echo ">>>>>>>>>>>>>>>>>>>>>>>> DEBUG 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Debug -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> RELEASE 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Release -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET DEBUG 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Debug" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET RELEASE 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Release" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

rem 64-bit client
%envsetup% x86_amd64

echo ">>>>>>>>>>>>>>>>>>>>>>>> DEBUG 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Debug -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> RELEASE 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Release -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET DEBUG 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Debug" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET RELEASE 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Release" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

rem Examples
%envsetup% x86

echo "Building BugTrap.Examples [Debug|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Debug -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Release|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Release -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Debug|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Release|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

%envsetup% x86_amd64

echo "Building BugTrap.Examples [Debug|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Debug -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Release|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Release -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Debug|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Release|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

%envsetup% x86

echo "Building BugTrap.Examples [Debug|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Debug -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Release|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Release -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Debug|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Release|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

rem Windows server
echo "Building BugTrapServer [Debug|Any CPU]"
msbuild source\BugTrapServer.vs2013.sln -p:Configuration=Debug -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrapServer [Release|Any CPU]"
msbuild source\BugTrapServer.vs2013.sln -p:Configuration=Release -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

rem Windows web server
echo "Building BugTrapWebServer [Debug|Any CPU]"
msbuild source\BugTrapWebServer.vs2013.sln -p:Configuration=Debug -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrapWebServer [Release|Any CPU]"
msbuild source\BugTrapWebServer.vs2013.sln -p:Configuration=Release -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

rem Java server
rem XXX: add java server build script

@ECHO OFF
SETLOCAL

REM Uncomment to forcibly set the build version.
REM set FORCE_VERSION=0.0.4-alpha4

IF NOT DEFINED DevEnvDir (
    IF DEFINED vs120comntools (
        set envsetup=call "%vs120comntools%\..\..\VC\vcvarsall.bat"
    ) else (
        echo "VS120COMNTOOLS is not defined, aborting."
        exit /b 1
    )
)

rem Install additional libraries (vc_mbcsmfc + boost.regex)
powershell -file install-dependencies.ps1

rem Restore NuGet packages
nuget restore source\BugTrap.vs2013.sln

rem Add boost to include and library paths
set "INCLUDE=C:\Libraries\boost;%INCLUDE%"
set "LIB=C:\Libraries\boost\stage\lib;%LIB%"

rem Additional arguments required for msbuild to use INCLUDE and LIB
set "MSB_ADD_ARGS=-p:useenv=true"

rem 32-bit client
%envsetup% x86

echo ">>>>>>>>>>>>>>>>>>>>>>>> DEBUG 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Debug -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> RELEASE 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Release -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET DEBUG 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Debug" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET RELEASE 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Release" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> Unicode DEBUG 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> Unicode RELEASE 32"
msbuild source\BugTrap.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

rem 64-bit client
%envsetup% x86_amd64

echo ">>>>>>>>>>>>>>>>>>>>>>>> DEBUG 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Debug -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> RELEASE 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=Release -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET DEBUG 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Debug" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> .NET RELEASE 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration=".NET Release" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> Unicode DEBUG 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo ">>>>>>>>>>>>>>>>>>>>>>>> Unicode RELEASE 64"
msbuild source\BugTrap.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

rem Examples
%envsetup% x86

echo "Building BugTrap.Examples [Debug|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Debug -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Release|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Release -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Debug|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Release|Win32]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=Win32 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

%envsetup% x86_amd64

echo "Building BugTrap.Examples [Debug|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Debug -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Release|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Release -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Debug|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Release|x64]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=x64 %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

%envsetup% x86

echo "Building BugTrap.Examples [Debug|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Debug -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Release|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration=Release -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Debug|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Debug" -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrap.Examples [Unicode Release|.NET x86]"
msbuild source\BugTrap.Examples.vs2013.sln -p:Configuration="Unicode Release" -p:Platform=".NET x86" %MSB_ADD_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

rem Windows server
echo "Building BugTrapServer [Debug|Any CPU]"
msbuild source\BugTrapServer.vs2013.sln -p:Configuration=Debug -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrapServer [Release|Any CPU]"
msbuild source\BugTrapServer.vs2013.sln -p:Configuration=Release -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

rem Windows web server
echo "Building BugTrapWebServer [Debug|Any CPU]"
msbuild source\BugTrapWebServer.vs2013.sln -p:Configuration=Debug -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

echo "Building BugTrapWebServer [Release|Any CPU]"
msbuild source\BugTrapWebServer.vs2013.sln -p:Configuration=Release -p:Platform="Any CPU"
if %errorlevel% neq 0 exit /b %errorlevel%

rem Java server
rem XXX: add java server build script

Add unicode configurations to build script.