if "%WindowsSdkDir%" neq "" goto build
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" goto initialize2k8on64
if exist "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" goto initialize2k8
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11
if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11
echo "Unable to detect suitable environment. Build may not succeed."
goto build

:initialize2k8
call "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
goto build

:initialize2k8on64
call "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
goto build

:initialize2k8Dev11
call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
goto build

:initialize2k8on64Dev11
call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
goto build

:build
call build %~1 %~2
pause
goto end

:end

if "%WindowsSdkDir%" neq "" goto build
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize12on64
if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize12
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize11on64
if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize11
echo "Unable to detect suitable environment. Build may not succeed."
goto build

:initialize11
call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
goto build

:initialize11on64
call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
goto build

:initialize12
call "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
goto build

:initialize12on64
call "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
goto build

:build
call build %~1 %~2
pause
goto end

:end

update build to use VS2012/VS2013.

update build to use  VS2012/VS2013.


@echo off

SET NVIMPATH="%USERPROFILE%\AppData\Local\nvim"
SET DOTPATH="%USERPROFILE%\dotfiles"

:Menu
    pushd %0\..

    cls
    echo ----------------------------------------------------------------------
    echo       Install Dotfiles
    echo ----------------------------------------------------------------------
    echo  r: Repository update.
    echo  n: Nvim settings.
    echo  p: Pipenv setup.
    echo  q: Quit.
    echo ----------------------------------------------------------------------

    set input=nul
    set /p input=Input:

    if '%input%'=='r' goto Repo
    if '%input%'=='n' goto Nvim
    if '%input%'=='p' goto Pipenv
    if '%input%'=='q' goto :EOF

    goto Menu

:Repo
    cls

    git pull origin master
    git submodule init
    git submodule update
    git submodule foreach git pull origin master

    pause
    goto Menu

:Nvim
    cls

    xcopy /s /e /y %DOTPATH%\config\nvim %NVIMPATH%

    pause
    goto Menu

:Pipenv
    cls

    pushd %NVIMPATH%

    SET PIPENV_VENV_IN_PROJECT=true
    pipenv install

    popd

    pause
    goto Menu

@echo off

SET NVIMPATH="%USERPROFILE%\AppData\Local\nvim"
SET DOTPATH="%USERPROFILE%\dotfiles"

:Menu
    pushd %0\..

    cls
    echo ----------------------------------------------------------------------
    echo       Install Dotfiles
    echo ----------------------------------------------------------------------
    echo  r: Repository update.
    echo  n: Nvim settings.
    echo  p: Pipenv setup.
    echo  q: Quit.
    echo ----------------------------------------------------------------------

    set input=nul
    set /p input=Input:

    if '%input%'=='r' goto Repo
    if '%input%'=='n' goto Nvim
    if '%input%'=='p' goto Pipenv
    if '%input%'=='q' goto :EOF

    goto Menu

:Repo
    cls

    git pull origin master
    rem git submodule init
    rem git submodule update
    rem git submodule foreach git pull origin master

    pause
    goto Menu

:Nvim
    cls

    xcopy /s /e /y %DOTPATH%\config\nvim %NVIMPATH%

    pause
    goto Menu

:Pipenv
    cls

    pushd %NVIMPATH%

    SET PIPENV_VENV_IN_PROJECT=true
    pipenv install

    popd

    pause
    goto Menu

update windows installer

update windows installer


@echo off

:: Configuration
set VERSION_URL=https://raw.githubusercontent.com/limix/bgen/master/VERSION
for /f %%i in ('curl -s %VERSION_URL%') do set VERSION=%%i
set FILE=bgen-%VERSION%.zip
set DIR=bgen-%VERSION%
set URL=https://github.com/limix/bgen/archive/%VERSION%.zip

echo [0/5] Library(bgen==%VERSION%)

:: Ancient Windows don't support TLS 1.1 and 1.2, so we fall back to insecure download.
set Version=
for /f "skip=1" %%v in ('wmic os get version') do if not defined Version set Version=%%v
for /f "delims=. tokens=1-3" %%a in ("%Version%") do (
  set Version.Major=%%a
  set Version.Minor=%%b
  set Version.Build=%%c
)

set OLD_WINDOWS=
if %Version.Major% LSS 6 set OLD_WINDOWS=1

set CURL_INSECURE=
if defined OLD_WINDOWS (
  set CURL_INSECURE=--insecure
)

SET ORIGIN=%cd%
call :joinpath "%ORIGIN%" "install.log"
SET LOG_FILE=%Result%

:: Cleaning up previous mess
del /Q %FILE% ! >nul 2>&1
rd /S /Q %DIR% >nul 2>&1
del /Q %LOG_FILE% ! >nul 2>&1
copy /y nul %LOG_FILE% >nul 2>&1

echo|set /p="[1/5] Downloading... "
echo Fetching %URL% >>%LOG_FILE% 2>&1
curl %CURL_INSECURE% -fsS -o %FILE% -L %URL% >>%LOG_FILE% 2>&1
if %ERRORLEVEL% NEQ 0 (echo FAILED. && echo Log can be found at %LOG_FILE%. && exit /B 1) else (echo done.)

echo|set /p="[2/5] Extracting... "
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%FILE%', '.'); }"
if %ERRORLEVEL% NEQ 0 (echo FAILED. && echo Log can be found at %LOG_FILE%. && exit /B 1) else (echo done.)

cd %DIR% && mkdir build && cd build

echo|set /p="[3/5] Configuring... "
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%programfiles%\bgen" >>%LOG_FILE% 2>&1
if %ERRORLEVEL% NEQ 0 (echo FAILED. && echo Log can be found at %LOG_FILE%. && exit /B 1) else (echo done.)

echo|set /p="[4/5] Compiling... "
nmake >>%LOG_FILE% 2>&1
if %ERRORLEVEL% NEQ 0 (echo FAILED. && echo Log can be found at %LOG_FILE%. && exit /B 1) else (echo done.)

echo|set /p="[5/5] Installing... "
nmake install >>%LOG_FILE% 2>&1
set PATH=%PATH%;%programfiles%\bgen\bin
if %ERRORLEVEL% NEQ 0 (echo FAILED. && echo Log can be found at %LOG_FILE%. && exit /B 1) else (echo done.)

cd %ORIGIN% >nul 2>&1
del /Q %FILE% >nul 2>&1
rd /S /Q %DIR% >nul 2>&1

echo Details can be found at %LOG_FILE%.

@echo on
@goto :eof

:joinpath
set Path1=%~1
set Path2=%~2
if {%Path1:~-1,1%}=={\} (set Result=%Path1%%Path2%) else (set Result=%Path1%\%Path2%)
goto :eof

install on windows

install on windows


@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.2.2
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

echo 1. Select node version
call :SelectNodeVersion

echo 2. Install npm packages
IF EXIST "package.json" (
  pushd "%DEPLOYMENT_SOURCE%"
  call :ExecuteCmd !NPM_CMD! install --production -d
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

echo 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.2.2
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

echo 1. Select node version
call :SelectNodeVersion

echo 2. Install npm packages
IF EXIST "package.json" (
  call npm install --production -d
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

echo 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

fix kudu

fix kudu


@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=node "%appdata%\npm\node_modules\kuduSync\bin\kuduSync"
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "%NPM_JS_PATH%"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.
echo hello, world

:: 1. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Select node version
call :SelectNodeVersion

:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd %DEPLOYMENT_TARGET%
  call !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

node --version
jake.bat prepareTempDirectory

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

goto end

:error
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
echo Finished successfully.

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=node "%appdata%\npm\node_modules\kuduSync\bin\kuduSync"
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "%NPM_JS_PATH%"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.
echo hello, world

:: 1. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Select node version
call :SelectNodeVersion

:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd %DEPLOYMENT_TARGET%
  call !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

node --version
jake.bat prepareTempDirectory
jake.bat buildClientBundle

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

goto end

:error
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
echo Finished successfully.

add command to bundle js/css/etc

add command to bundle js/css/etc


@ECHO OFF

:: setup my variables
set OLDDIR=%CD%
SET "dir="D:\Archive\arccasperdeploy""
SET url=git@github.com:kaveh096/ArcCASPER.git

:: clean enviroment
IF NOT EXIST %dir% ( git clone %url% %dir% )
cd %dir%

:: call build function
call:buildFunc dev nightly
call:buildFunc master stable

goto :exit

:: ------------------------------------- build and post function
:buildFunc

:: switch to branch
git checkout %1
git pull

:: get hash of head
for /f %%i in ('git describe') do set hash=%%i
set out=ArcCASPER-%2%-%rev%.zip

:: TODO create changle.log from 'git shortlog --no-merges %1 --not v10.1'

:: check if there is new commit to be built
for /f %%i in ('d:\cygwin64\bin\bash.exe -c "/home/kshahabi/dropbox_uploader.sh list | grep %rev% | wc -l"') do set iscommit=%%i
if %iscommit%==1 (
  echo No new code is commited to %1% branch
  goto :eof
)

:: build clean
set NOREG=1
del /Q Package\EvcSolver32.*
del /Q Package\EvcSolver64.*
msbuild.exe /m /target:build /p:Configuration=Release /p:Platform=Win32 USC.GISResearchLab.ArcCASPER.sln
msbuild.exe /m /target:build /p:Configuration=Release /p:Platform=x64   USC.GISResearchLab.ArcCASPER.sln

:: Generate readme file
"c:\Program Files (x86)\GnuWin32\bin\sed.exe" -e "s/REV/%rev%/g" README.md > Package\README.md

:: post to dropbox
cd Package
"c:\Program Files\7-Zip\7z.exe" a %out% -i@file.list
if %errorlevel%==0 (
  echo Uploading to dropbox for public access
  d:\cygwin64\bin\bash.exe -c '/home/kshahabi/dropbox_uploader.sh upload `cygpath -u "%CD%\%out%"` %out%'
) else (
  echo Some of the files are not present
)
goto :eof
:: ------------------------------------- end of build function

:: restore current directory and then exit
:exit
chdir /d %OLDDIR%
exit 0

@ECHO OFF

:: setup my variables
set OLDDIR=%CD%
SET "dir="D:\Archive\arccasperdeploy""
SET url=git@github.com:kaveh096/ArcCASPER.git

:: clean enviroment
IF NOT EXIST %dir% ( git clone %url% %dir% )
cd %dir%

:: call build function
call:buildFunc dev nightly
call:buildFunc master stable

goto :exit

:: ------------------------------------- build and post function
:buildFunc

:: switch to branch
git checkout %1
git pull

:: get hash of head
for /f %%i in ('git describe') do set revi=%%i
set "out=ArcCASPER-%revi%-%2%.zip"

:: TODO create changle.log from 'git shortlog --no-merges %1 --not v10.1'

:: check if there is new commit to be built
for /f %%i in ('d:\cygwin64\bin\bash.exe -c "/home/kshahabi/dropbox_uploader.sh list | grep %revi% | wc -l"') do set iscommit=%%i
if %iscommit%==1 (
  echo No new code is commited to %1% branch
  goto :eof
)

:: build clean
set NOREG=1
del /Q Package\EvcSolver32.*
del /Q Package\EvcSolver64.*
::msbuild.exe /m /target:rebuild /p:Configuration=Release /p:Platform=Win32 USC.GISResearchLab.ArcCASPER.sln
::msbuild.exe /m /target:rebuild /p:Configuration=Release /p:Platform=x64   USC.GISResearchLab.ArcCASPER.sln

:: Generate readme file
"c:\Program Files (x86)\GnuWin32\bin\sed.exe" -e "s/REV/%revi%/g" README.md > Package\README.md

:: post to dropbox
cd Package
"c:\Program Files\7-Zip\7z.exe" a %out% -i@file.list
if %errorlevel%==0 (
  echo Uploading to dropbox for public access
  d:\cygwin64\bin\bash.exe -c '/home/kshahabi/dropbox_uploader.sh upload `cygpath -u "%CD%\%out%"` %out%'
) else (
  echo Some of the files are not present
)
goto :eof
:: ------------------------------------- end of build function

:: restore current directory and then exit
:exit
chdir /d %OLDDIR%

deploy script updated to have revision number


@echo off
boot2docker start
boot2docker ssh sudo cp -f %unixpath%/profile /var/lib/boot2docker/profile
boot2docker ssh sudo /etc/init.d/docker restart
boot2docker ssh cp -f %unixpath%/profile .ashrc
boot2docker ssh cp -f %unixpath%/.bash_aliases .bash_aliases
boot2docker ssh

@echo off
boot2docker start

REM already running means controlvm (as opposed to modifyvm)

VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port80,tcp,,80,,80"; 2> NUL
VBoxManage controlvm "boot2docker-vm" natpf1 "udp-port80,udp,,80,,80"; 2> NUL

VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port443,tcp,,443,,443"; 2> NUL
VBoxManage controlvm "boot2docker-vm" natpf1 "udp-port443,udp,,443,,443"; 2> NUL

VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port8443,tcp,,8443,,8443"; 2> NUL
VBoxManage controlvm "boot2docker-vm" natpf1 "udp-port8443,udp,,8443,,8443"; 2> NUL

VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port8543,tcp,,8543,,8543"; 2> NUL
VBoxManage controlvm "boot2docker-vm" natpf1 "udp-port8543,udp,,8543,,8543"; 2> NUL
VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port8553,tcp,,8553,,8553"; 2> NUL
VBoxManage controlvm "boot2docker-vm" natpf1 "udp-port8553,udp,,8553,,8553"; 2> NUL

boot2docker ssh sudo cp -f %unixpath%/profile /var/lib/boot2docker/profile
boot2docker ssh sudo /etc/init.d/docker restart
boot2docker ssh cp -f %unixpath%/profile .ashrc
boot2docker ssh cp -f %unixpath%/.bash_aliases .bash_aliases
boot2docker ssh

add port forwarding in boot2docker-vm

b2d.bat: add port forwarding in boot2docker-vm


@echo off

(
if not exist Htpc.py (
    for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
    if defined FOUND (
        DEL "%~f0"
        git clone https://github.com/styxit/HTPC-Manager.git .
    ) else (
        echo "Git not installed. Install from: http://msysgit.github.io/"
        pause
        exit
    )
)
start cmd /c python Htpc.py
exit
)

@echo off

(
if not exist Htpc.py (
    for %%X in (git.exe) do (set FOUND=%%~$PATH:X)
    if defined FOUND (
        DEL "%~f0"
        git clone https://github.com/Hellowlol/HTPC-Manager.git .
    ) else (
        echo "Git not installed. Install from: http://msysgit.github.io/"
        pause
        exit
    )
)
start cmd /c python Htpc.py
exit
)

change user, dont think anybody will use it


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

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

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

%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild Source/ArduinoLibCSharp.sln /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 "Source\ArduinoLibCSharp.IntelHexFormatReader\ArduinoLibCSharp.IntelHexFormatReader.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"
%nuget% pack "Source\ArduinoLibCSharp.ArduinoUploader\ArduinoLibCSharp.ArduinoUploader.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.1
if not "%PackageVersion%" == "" (
   set version=%PackageVersion%
)

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

%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild Source/ArduinoLibCSharp.sln /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 "Source\ArduinoLibCSharp.ArduinoUploader\ArduinoLibCSharp.ArduinoUploader.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

%nuget% pack "Source\ArduinoLibCSharp.IntelHexFormatReader\ArduinoLibCSharp.IntelHexFormatReader.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

Change around build.bat.

Change around build.bat.


@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=*" %%1 in ('wevtutil.exe el') DO wevtutil.exe cl "%%1"

Add clearAllEvents.bat

Add clearAllEvents.bat


echo off
setlocal
REM elevated window does not set current directory correctly.
REM Workaround it by passing the current directory around
pushd %1

echo BridgeKeepRunning=%BridgeKeepRunning%
if '%BridgeKeepRunning%' neq 'true' (
    echo Stopping the Bridge.exe task locally...
    Taskkill /IM bridge.exe /F
    netsh http delete sslcert ipport=0.0.0.0:44285
    certutil.exe -delstore my "85 58 be 22 44 5e 00 96 4d 0e 4c 7e 47 7a a6 3a"
    certutil -delstore Root "68 66 63 1a d6 d4 28 ab 49 82 7f ba 24 cc 33 26"
) else (
    echo Bridge is left running because BridgeKeepRunning is true
)

exit /b

echo off
setlocal
pushd %~dp0

echo BridgeKeepRunning=%BridgeKeepRunning%
if '%BridgeKeepRunning%' neq 'true' (
    echo Stopping the Bridge.exe task locally...
    Taskkill /IM bridge.exe /F
    netsh http delete sslcert ipport=0.0.0.0:44285
    certutil.exe -delstore my "85 58 be 22 44 5e 00 96 4d 0e 4c 7e 47 7a a6 3a"
    certutil -delstore Root "68 66 63 1a d6 d4 28 ab 49 82 7f ba 24 cc 33 26"
) else (
    echo Bridge is left running because BridgeKeepRunning is true
)

exit /b

Clean script no longer requires working folder passed in


PATH=C:\python26;C:\progra~2\7-zip;%PATH%
del /q /s dist\*.*
python setup.py py2exe
cd dist
7z d library.zip jinja2\* dns\* 'graphy\*
7z a namebench_for_Windows.zip -r *
namebench -x -O 8.8.8.8 -t5 -o test.html
start test.html

cd ..

PATH=C:\python26;C:\progra~2\7-zip;%PATH%
del /q /s dist\*.*
python setup.py py2exe
cd dist
7z d library.zip jinja2\* dns\* 'graphy\*
del /s w9xpopen.exe
copy ..\README.txt .
7z a namebench_for_Windows.zip -r *
namebench -x -O 8.8.8.8 -t5 -o test.html
start test.html

cd ..

Remove w9xopen.exe and add README.txt to Windows build


@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXAPIDOC%" == "" (
	set SPHINXAPIDOC=sphinx-apidoc
)
if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)

set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help

if "%1" == "help" (
	:help
	echo.Please use `make ^<target^>` where ^<target^> is one of
	echo.  clean      to delete the build directory and all RST files except index.rst
	echo.  rst        to build the RST files from the source directory
	echo.  html       to make standalone HTML files
	echo.  dirhtml    to make HTML files named index.html in directories
	echo.  singlehtml to make a single large HTML file
	echo.  pickle     to make pickle files
	echo.  json       to make JSON files
	echo.  htmlhelp   to make HTML files and a HTML help project
	echo.  qthelp     to make HTML files and a qthelp project
	echo.  devhelp    to make HTML files and a Devhelp project
	echo.  epub       to make an epub
	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
	echo.  text       to make text files
	echo.  man        to make manual pages
	echo.  texinfo    to make Texinfo files
	echo.  gettext    to make PO message catalogs
	echo.  changes    to make an overview over all changed/added/deprecated items
	echo.  xml        to make Docutils-native XML files
	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
	echo.  linkcheck  to check all external links for integrity
	echo.  doctest    to run all doctests embedded in the documentation if enabled
	goto end
)

if "%1" == "clean" (
	move index.rst index.rst.saved
	move readme.rst readme.rst.saved
	del /q /s *.rst
	move index.rst.saved index.rst
	move readme.rst.saved readme.rst
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%
	goto end
)

%SPHINXAPIDOC% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-apidoc' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXAPIDOC environment variable to point
	echo.to the full path of the 'sphinx-apidoc' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

%SPHINXBUILD% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

if "%1" == "rst" (
	%SPHINXAPIDOC% -f -T -e -M -o . .. ../setup.py ../tests ../versioneer.py
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The RST pages are in in the current directory.
	goto end
)

if "%1" == "html" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
	goto end
)

if "%1" == "dirhtml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
	goto end
)

if "%1" == "singlehtml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
	goto end
)

if "%1" == "pickle" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the pickle files.
	goto end
)

if "%1" == "json" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the JSON files.
	goto end
)

if "%1" == "htmlhelp" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
	goto end
)

if "%1" == "qthelp" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\sphinx.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\sphinx.ghc
	goto end
)

if "%1" == "devhelp" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished.
	goto end
)

if "%1" == "epub" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The epub file is in %BUILDDIR%/epub.
	goto end
)

if "%1" == "latex" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdf" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdfja" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf-ja
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "text" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The text files are in %BUILDDIR%/text.
	goto end
)

if "%1" == "man" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The manual pages are in %BUILDDIR%/man.
	goto end
)

if "%1" == "texinfo" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
	goto end
)

if "%1" == "gettext" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
	goto end
)

if "%1" == "changes" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
	if errorlevel 1 exit /b 1
	echo.
	echo.The overview file is in %BUILDDIR%/changes.
	goto end
)

if "%1" == "linkcheck" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
	if errorlevel 1 exit /b 1
	echo.
	echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
	goto end
)

if "%1" == "doctest" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
	goto end
)

if "%1" == "xml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The XML files are in %BUILDDIR%/xml.
	goto end
)

if "%1" == "pseudoxml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
	goto end
)

:end

@ECHO OFF

REM Command file for Sphinx documentation

if "%SPHINXAPIDOC%" == "" (
	set SPHINXAPIDOC=sphinx-apidoc
)
if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)

set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)

if "%1" == "" goto help

if "%1" == "help" (
	:help
	echo.Please use `make ^<target^>` where ^<target^> is one of
	echo.  clean      to delete the build directory and all RST files except index.rst
	echo.  rst        to build the RST files from the source directory
	echo.  html       to make standalone HTML files
	echo.  dirhtml    to make HTML files named index.html in directories
	echo.  singlehtml to make a single large HTML file
	echo.  pickle     to make pickle files
	echo.  json       to make JSON files
	echo.  htmlhelp   to make HTML files and a HTML help project
	echo.  qthelp     to make HTML files and a qthelp project
	echo.  devhelp    to make HTML files and a Devhelp project
	echo.  epub       to make an epub
	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
	echo.  text       to make text files
	echo.  man        to make manual pages
	echo.  texinfo    to make Texinfo files
	echo.  gettext    to make PO message catalogs
	echo.  changes    to make an overview over all changed/added/deprecated items
	echo.  xml        to make Docutils-native XML files
	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
	echo.  linkcheck  to check all external links for integrity
	echo.  doctest    to run all doctests embedded in the documentation if enabled
	goto end
)

if "%1" == "clean" (
	move index.rst index.rst.saved
	move readme.rst readme.rst.saved
	move todo.rst todo.rst.saved
	del /q /s *.rst
	move index.rst.saved index.rst
	move readme.rst.saved readme.rst
	move todo.rst.saved todo.rst
	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
	del /q /s %BUILDDIR%
	goto end
)

%SPHINXAPIDOC% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-apidoc' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXAPIDOC environment variable to point
	echo.to the full path of the 'sphinx-apidoc' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

%SPHINXBUILD% 2> nul
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

if "%1" == "rst" (
	%SPHINXAPIDOC% -f -T -e -M -o . .. ../setup.py ../tests ../versioneer.py
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The RST pages are in in the current directory.
	goto end
)

if "%1" == "html" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
	goto end
)

if "%1" == "dirhtml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
	goto end
)

if "%1" == "singlehtml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
	goto end
)

if "%1" == "pickle" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the pickle files.
	goto end
)

if "%1" == "json" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can process the JSON files.
	goto end
)

if "%1" == "htmlhelp" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
	goto end
)

if "%1" == "qthelp" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\sphinx.qhcp
	echo.To view the help file:
	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\sphinx.ghc
	goto end
)

if "%1" == "devhelp" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished.
	goto end
)

if "%1" == "epub" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The epub file is in %BUILDDIR%/epub.
	goto end
)

if "%1" == "latex" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdf" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "latexpdfja" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
	cd %BUILDDIR%/latex
	make all-pdf-ja
	cd %BUILDDIR%/..
	echo.
	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
	goto end
)

if "%1" == "text" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The text files are in %BUILDDIR%/text.
	goto end
)

if "%1" == "man" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The manual pages are in %BUILDDIR%/man.
	goto end
)

if "%1" == "texinfo" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
	goto end
)

if "%1" == "gettext" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
	goto end
)

if "%1" == "changes" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
	if errorlevel 1 exit /b 1
	echo.
	echo.The overview file is in %BUILDDIR%/changes.
	goto end
)

if "%1" == "linkcheck" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
	if errorlevel 1 exit /b 1
	echo.
	echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
	goto end
)

if "%1" == "doctest" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
	if errorlevel 1 exit /b 1
	echo.
	echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
	goto end
)

if "%1" == "xml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The XML files are in %BUILDDIR%/xml.
	goto end
)

if "%1" == "pseudoxml" (
	%SPHINXBUILD% -f -T -o . .. ../tests
	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
	if errorlevel 1 exit /b 1
	echo.
	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
	goto end
)

:end

docs/make.bat: Make sure the TODO list is saved on `make.bat clean`.


rem dennyhalim.com
rem this will be copied after first reboot and then run after next reboot

#replace defaultlayouts before it gets created
move "%Public%\..\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml" "%Public%\..\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.dennyhalim"
copy /y "%WINDIR%\Setup\Files\DefaultLayouts.xml" "%Public%\..\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml"
move "%SystemRoot%\SysWOW64\OneDriveSetup.exe" "%SystemRoot%\SysWOW64\OneDriveSetup.dennyhalim"
move "%SystemRoot%\System32\OneDriveSetup.exe" "%SystemRoot%\System32\OneDriveSetup.dennyhalim"
rem move "%windir%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy" "%windir%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy.dennyhalim"
rem startmenu disabled if shellex disabled
rem move "%windir%\SystemApps\ShellExperienceHost_cw5n1h2txyewy" "%windir%\SystemApps\ShellExperienceHost_cw5n1h2txyewy.dennyhalim"

reg.exe load HKLM\DEFAULT "%Public%\..\default\ntuser.dat"
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People /v PeopleBand /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Start_TrackProgs /t REG_DWORD /d 1 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Input\TIPC" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v GlobalUserDisabled /t REG_DWORD /d 1 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{A8804298-2D5F-42E3-9531-9C8C39EB29CE}" /v Value /d Deny /f
reg.exe delete "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /F
reg.exe unload HKLM\DEFAULT

reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" /v LetAppsRunInBackground /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DeferUpgrade /t REG_DWORD /d 1 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v BranchReadinessLevel /t REG_DWORD /d 32 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DeferFeatureUpdates /t REG_DWORD /d 1 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DeferFeatureUpdatesPeriodinDays /t REG_DWORD /d 365 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCortana /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" /v WiFiSenseCredShared /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" /v WiFiSenseOpen /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" /v 1 /t REG_SZ /d pool.ntp.org /f

cscript.exe "%WINDIR%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -m "Canon LBP2900" -i "%WINDIR%\Setup\Drivers\CanonLBP2900\CNAB4STD.inf"
cscript.exe "%WINDIR%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -m "Canon G2000 series Printer" -i "%WINDIR%\Setup\Drivers\CanonG2000\Driver\G2000P6.inf"
rem move "%WINDIR%\Setup\Drivers\*" "%WINDIR%\INF"

schtasks.exe /change /TN "\Microsoft\Windows\Setup\SetupCleanupTask" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /DISABLE
dism.exe /online /norestart /Enable-Feature /FeatureName:TelnetClient
dism.exe /online /norestart /Disable-Feature /FeatureName:MediaPlayback
dism.exe /online /norestart /Disable-Feature /FeatureName:WindowsMediaPlayer
dism.exe /online /norestart /Disable-Feature /FeatureName:Indexing-Service-Package
dism.exe /online /norestart /Disable-Feature /FeatureName:Internet-Explorer-Optional-x86
dism.exe /online /norestart /Disable-Feature /FeatureName:Internet-Explorer-Optional-amd64

"%WINDIR%\Setup\Files\chocolatey.exe" /S
"%WINDIR%\Setup\Files\Firefox Setup 52.6.0esr.exe" -ms
"%WINDIR%\Setup\Files\vlc-3.0.1-win64.exe" /L=1033 /S
"%WINDIR%\Setup\Files\SumatraPDF-3.1.2-64-install.exe" /S
msiexec.exe /q /I "%WINDIR%\Setup\Files\just-install.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\NpackdCL-1.23.2.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\7z1801-x64.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\qalculate-2.4.0a.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\GoogleChromeStandaloneEnterprise64.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\LibreOffice_5.4.6_Win_x64.msi"
rem "%WINDIR%\Setup\Files\avira_pc_cleaner_en.exe" /s
"%WINDIR%\Setup\Files\mb3-setup-consumer-3.4.5.2467-1.0.342-1.0.4664.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
"%WINDIR%\Setup\Files\avast_business_antivirus_managed_setup_offline_silent.exe"

mkdir "%Public%\Desktop.dennyhalim"
move "%Public%\Desktop\*.*" "%Public%\Desktop.dennyhalim"
powershell.exe -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Progs\OpenSSH\install-sshd.ps1"
PowerShell.exe -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Files\setup.ps1"

sc.exe config wuauserv start= demand
sc.exe config DiagTrack start= disabled
sc.exe config dmwappushservice start= disabled
sc.exe config RetailDemo start= disabled
sc.exe config lfsvc start= disabled
sc.exe config ssh-agent start= auto
sc.exe config sshd start= auto

rem "%WINDIR%\Setup-githubbox.exe"

rem dennyhalim.com
rem this will be copied after first reboot and then run after next reboot

#replace defaultlayouts before it gets created
move "%Public%\..\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml" "%Public%\..\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.dennyhalim"
copy /y "%WINDIR%\Setup\Files\DefaultLayouts.xml" "%Public%\..\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml"
move "%SystemRoot%\SysWOW64\OneDriveSetup.exe" "%SystemRoot%\SysWOW64\OneDriveSetup.dennyhalim"
move "%SystemRoot%\System32\OneDriveSetup.exe" "%SystemRoot%\System32\OneDriveSetup.dennyhalim"
rem move "%windir%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy" "%windir%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy.dennyhalim"
rem startmenu disabled if shellex disabled
rem move "%windir%\SystemApps\ShellExperienceHost_cw5n1h2txyewy" "%windir%\SystemApps\ShellExperienceHost_cw5n1h2txyewy.dennyhalim"

reg.exe load HKLM\DEFAULT "%Public%\..\default\ntuser.dat"
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People /v PeopleBand /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Start_TrackProgs /t REG_DWORD /d 1 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Input\TIPC" /v Enabled /t REG_DWORD /d 0 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v GlobalUserDisabled /t REG_DWORD /d 1 /f
reg.exe add "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{A8804298-2D5F-42E3-9531-9C8C39EB29CE}" /v Value /d Deny /f
reg.exe delete "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /F
reg.exe unload HKLM\DEFAULT

reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" /v LetAppsRunInBackground /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DeferUpgrade /t REG_DWORD /d 1 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v BranchReadinessLevel /t REG_DWORD /d 32 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DeferFeatureUpdates /t REG_DWORD /d 1 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DeferFeatureUpdatesPeriodinDays /t REG_DWORD /d 365 /f
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCortana /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" /v WiFiSenseCredShared /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" /v WiFiSenseOpen /t REG_DWORD /d 0 /f
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers" /v 1 /t REG_SZ /d pool.ntp.org /f

cscript.exe "%WINDIR%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -m "Canon LBP2900" -i "%WINDIR%\Setup\Drivers\CanonLBP2900\CNAB4STD.inf"
cscript.exe "%WINDIR%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -m "Canon G2000 series Printer" -i "%WINDIR%\Setup\Drivers\CanonG2000\Driver\G2000P6.inf"
rem move "%WINDIR%\Setup\Drivers\*" "%WINDIR%\INF"

schtasks.exe /change /TN "\Microsoft\Windows\Setup\SetupCleanupTask" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" /DISABLE
schtasks.exe /change /TN "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /DISABLE
dism.exe /online /norestart /Enable-Feature /FeatureName:TelnetClient
dism.exe /online /norestart /Disable-Feature /FeatureName:MediaPlayback
dism.exe /online /norestart /Disable-Feature /FeatureName:WindowsMediaPlayer
dism.exe /online /norestart /Disable-Feature /FeatureName:WindowsGadgetPlatform
dism.exe /online /norestart /Disable-Feature /FeatureName:Indexing-Service-Package
dism.exe /online /norestart /Disable-Feature /FeatureName:Internet-Explorer-Optional-x86
dism.exe /online /norestart /Disable-Feature /FeatureName:Internet-Explorer-Optional-amd64

"%WINDIR%\Setup\Files\chocolatey.exe" /S
"%WINDIR%\Setup\Files\Firefox Setup 52.6.0esr.exe" -ms
"%WINDIR%\Setup\Files\vlc-3.0.1-win64.exe" /L=1033 /S
"%WINDIR%\Setup\Files\SumatraPDF-3.1.2-64-install.exe" /S
msiexec.exe /q /I "%WINDIR%\Setup\Files\just-install.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\NpackdCL-1.23.2.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\7z1801-x64.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\qalculate-2.4.0a.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\GoogleChromeStandaloneEnterprise64.msi"
msiexec.exe /q /I "%WINDIR%\Setup\Files\LibreOffice_5.4.6_Win_x64.msi"
rem "%WINDIR%\Setup\Files\avira_pc_cleaner_en.exe" /s
"%WINDIR%\Setup\Files\mb3-setup-consumer-3.4.5.2467-1.0.342-1.0.4664.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
"%WINDIR%\Setup\Files\avast_business_antivirus_managed_setup_offline_silent.exe"

mkdir "%Public%\Desktop.dennyhalim"
move "%Public%\Desktop\*.*" "%Public%\Desktop.dennyhalim"
powershell.exe -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Progs\OpenSSH\install-sshd.ps1"
PowerShell.exe -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Files\setup.ps1"

sc.exe config wuauserv start= demand
sc.exe config DiagTrack start= disabled
sc.exe config dmwappushservice start= disabled
sc.exe config RetailDemo start= disabled
sc.exe config lfsvc start= disabled
sc.exe config ssh-agent start= auto
sc.exe config sshd start= auto

rem "%WINDIR%\Setup-githubbox.exe"

Update SetupComplete.cmd

Update SetupComplete.cmd


@ECHO off
if not exists values.txt echo. 2>values.txt
java -jar %UTILS_PATH%\yhack\yhack.jar %1 %2 %3 %4 %5 %6 %7 %8

@ECHO off
if not exists %UTILS_PATH%\yhack\values.txt echo. 2>values.txt
java -jar %UTILS_PATH%\yhack\yhack.jar %1 %2 %3 %4 %5 %6 %7 %8

Update release

Update release


@setlocal enabledelayedexpansion
@echo off
@rem ***************************************
@rem Arguments
@rem %1: Copy TestData (1:true, 0:false)
@rem ***************************************

if "%1"=="" (
  @echo Error: Copy TestData [1/0]
  @exit /B
)

if "%1"=="1" (
  set DST_DATA=test\DlibDotNet.Tests\bin\Release\netcoreapp2.1\data
  if NOT EXIST "!DST_DATA!" (
     mkdir "!DST_DATA!"
  )
  xcopy test\DlibDotNet.Tests\data "!DST_DATA!" /y /s
)

dotnet test test\DlibDotNet.Tests\DlibDotNet.Tests.csproj -c Release

add test batch file

feat: add test batch file


@ECHO OFF

SET CLASSPATH=%SystemDrive%%HomePath%\.nuget\packages\Antlr4.CodeGenerator\4.5.4-beta001\tools\antlr4-csharp-4.5.4-SNAPSHOT-complete.jar
SET Namespace=sdmap.Parser.G4
SET  G4Folder=%~dp0
SET   Options=-Dlanguage=CSharp_v4_5 -package %Namespace% -visitor -listener -encoding UTF8

SET    G4File=SdmapLexer
DEL /Q ^
	%G4Folder%%G4File%.tokens		  ^
	%G4Folder%%G4File%.cs
SET FullPath=%G4Folder%%G4File%.g4
JAVA org.antlr.v4.Tool %FullPath% %Options%

SET    G4File=SdmapParser
DEL /Q ^
	%G4Folder%%G4File%.tokens		  ^
	%G4Folder%%G4File%.cs		  ^
	%G4Folder%%G4File%Listener.cs	  ^
	%G4Folder%%G4File%BaseListener.cs ^
	%G4Folder%%G4File%Visitor.cs	  ^
	%G4Folder%%G4File%BaseVisitor.cs
SET FullPath=%G4Folder%%G4File%.g4
JAVA org.antlr.v4.Tool %FullPath% %Options%

align ^

align ^


cmake . -G "NMake Makefiles" ^
    -DCMAKE_PREFIX_PATH=%PREFIX% ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DHDF5_LIBRARIES=%LIBRARY_PREFIX%\lib\libhdf5.lib;%LIBRARY_PREFIX%\lib\zlib.lib ^
    -DHDF5_ROOT_DIR=%LIBRARY_PREFIX% ^
    -DMEDFILE_INSTALL_DOC=OFF

rem MEDFILE_BUILD_PYTHON -> swig, maybe this is a nice option

if errorlevel 1 exit 1
nmake install
if errorlevel 1 exit 1

move %LIBRARY_PREFIX%\lib\medC.dll %LIBRARY_PREFIX%\bin

rmdir /s /q %LIBRARY_PREFIX%\share

cmake . -G "NMake Makefiles" ^
    -DCMAKE_PREFIX_PATH=%PREFIX% ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DHDF5_LIBRARIES=%LIBRARY_PREFIX%\lib\libhdf5.lib;%LIBRARY_PREFIX%\lib\zlib.lib ^
    -DHDF5_ROOT_DIR=%LIBRARY_PREFIX% ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DMEDFILE_INSTALL_DOC=OFF

rem MEDFILE_BUILD_PYTHON -> swig, maybe this is a nice option

if errorlevel 1 exit 1
set CL=/MP
nmake install
if errorlevel 1 exit 1

move %LIBRARY_PREFIX%\lib\medC.dll %LIBRARY_PREFIX%\bin
move %LIBRARY_PREFIX%\lib\medimport.dll %LIBRARY_PREFIX%\bin

copy another dll, build release

libmed: copy another dll, build release


ECHO APPVEYOR_REPO_BRANCH: %APPVEYOR_REPO_BRANCH%
ECHO APPVEYOR_REPO_TAG: %APPVEYOR_REPO_TAG%
ECHO APPVEYOR_BUILD_NUMBER : %APPVEYOR_BUILD_NUMBER%
ECHO APPVEYOR_BUILD_VERSION : %APPVEYOR_BUILD_VERSION%
Call Tools\nuget.exe restore ..\Slimsy.sln

cd buildpackage

SET toolsFolder=%CD%\tools\
IF NOT EXIST "%toolsFolder%" (
  MD tools
)

IF NOT EXIST "%toolsFolder%vswhere.exe" (
  ECHO vswhere not found - fetching now
  nuget install vswhere -Version 2.2.7 -Source nuget.org -OutputDirectory tools
)

FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A\"
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"

for /f "usebackq tokens=1* delims=: " %%i in (`"%CD%\tools\vswhere.exe" -latest -requires Microsoft.Component.MSBuild`) do (
  if /i "%%i"=="installationPath" set InstallDir=%%j
)

SET VSWherePath="%InstallDir%\MSBuild"

ECHO.
ECHO Visual Studio is installed in: %InstallDir%

CALL "%InstallDir%\MSBuild\15.0\Bin\amd64\MsBuild.exe" package.proj %~1

@IF %ERRORLEVEL% NEQ 0 GOTO err
@EXIT /B 0
:err
@EXIT /B 1

ECHO APPVEYOR_REPO_BRANCH: %APPVEYOR_REPO_BRANCH%
ECHO APPVEYOR_REPO_TAG: %APPVEYOR_REPO_TAG%
ECHO APPVEYOR_BUILD_NUMBER : %APPVEYOR_BUILD_NUMBER%
ECHO APPVEYOR_BUILD_VERSION : %APPVEYOR_BUILD_VERSION%
Call Tools\nuget.exe restore ..\Slimsy.sln

cd buildpackage

SET toolsFolder=%CD%\tools\
IF NOT EXIST "%toolsFolder%" (
	MD tools
)

IF NOT EXIST "%toolsFolder%vswhere.exe" (
	ECHO vswhere not found - fetching now
	nuget install vswhere -Version 2.8.4 -Source nuget.org -OutputDirectory tools
)

FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A\"
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"

SETLOCAL EnableDelayedExpansion

set vswherestr=^"!%CD%\tools\vswhere.exe^" -latest -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
for /f "usebackq tokens=*" %%i in (`!vswherestr!`) do (
  set MsBuildDir=%%i
)

ECHO.
ECHO MsBuild is installed in: %MsBuildDir%

CALL "%MsBuildDir%" package.proj %~1

@IF %ERRORLEVEL% NEQ 0 GOTO err
@EXIT /B 0
:err
@EXIT /B 1

Update VSWhere

Update VSWhere


@echo off

@set PATH_ORG=%PATH%
@set PYTHON_BASE=%~d0\local\Python27
@set PATH=%PYTHON_BASE%;%PYTHON_BASE%\Scripts;%PYTHON_BASE%\Lib;%PYTHON_BASE%\Lib\site-packages\pywin32_system32;%PATH%
@set PYTHONPATH=%PYTHON_BASE%\Lib\site-packages;%PYTHON_BASE%\Lib\site-packages\rtctree\rtmidl\;%~dp0..

@echo on

%PYTHON_BASE%\python GoogleSpeechRecogRTC\GoogleSpeechRecogRTC.py

@set PATH=%PATH_ORG%

@echo off

@set PATH_ORG=%PATH%
@set PYTHON_BASE=%~d0\local\Python27
@set PATH=%PYTHON_BASE%;%PYTHON_BASE%\Scripts;%PYTHON_BASE%\Lib;%PYTHON_BASE%\Lib\site-packages\pywin32_system32;%PYTHON_BASE%\ffmpeg\3.3.3\bin;%PATH%
@set PYTHONPATH=%PYTHON_BASE%\Lib\site-packages;%PYTHON_BASE%\Lib\site-packages\rtctree\rtmidl\;%~dp0..

@echo on

%PYTHON_BASE%\python GoogleSpeechRecogRTC\GoogleSpeechRecogRTC.py

@set PATH=%PATH_ORG%

update GoogleSpeech.bat

update GoogleSpeech.bat


"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1

make sure we have no windows line endings


if "%1"=="" goto noargs
	svn copy http://plugins.svn.wordpress.org/comment-timeout/trunk http://plugins.svn.wordpress.org/comment-timeout/tags/%1 -m "Tag release %1"
	goto done:
noargs:
	echo Usage: tag VERSION
	echo.
	echo Tags the latest release in Subversion as a numbered version.
done:

@echo off
if "%1"=="" goto noargs
	svn copy http://plugins.svn.wordpress.org/comment-timeout/trunk http://plugins.svn.wordpress.org/comment-timeout/tags/%1 -m "Tag release %1"
	goto done
noargs:
	echo Usage: tag VERSION
	echo.
	echo Tags the latest release in Subversion as a numbered version.
done:

Fix tag.bat and make it silent.

Fix tag.bat and make it silent.


add exit /b ERRORLEVEL

t/batchtst.cmd: add exit /b ERRORLEVEL


mkdir uvision_release
git rev-parse --verify HEAD                     > uvision_release\git_info.txt
git diff --no-ext-diff --quiet --exit-code      >> uvision_release\git_info.txt
echo Uncommitted Changes: %errorlevel%          >> uvision_release\git_info.txt
virtualenv env
call env\Scripts\activate
pip install -r requirements.txt
pip freeze                                      > uvision_release\build_requirements.txt
pgen export -t uvision -b
python tools/copy_release_files.py

mkdir uvision_release
git rev-parse --verify HEAD                     > uvision_release\git_info.txt
git diff --no-ext-diff --quiet --exit-code      >> uvision_release\git_info.txt
echo Uncommitted Changes: %errorlevel%          >> uvision_release\git_info.txt
virtualenv env
call env\Scripts\activate
REM use project requirements if not specified
if [%1]==[] pip install -r requirements.txt
REM use custom requirements if specified
if not [%1]==[] pip install -r %1
pip freeze                                      > uvision_release\build_requirements.txt
pgen export -t uvision -b
python tools/copy_release_files.py

Allow requirements file to be specified for build

If a requirements file is specified as an argument to
build_release_uvision.bat use it to create the build.  This allows
builds using older tools to be easily reproduced.


@ECHO OFF

REM OBIT LIBS PATH
SET OBIT_LIBS_PATH=%CD%\..

REM SET THE PATH OF THE CORE-TECHNOLOGIES
SET FLOW_PATH=%OBIT_LIBS_PATH%\..\..\..\..\server\obit_flow_core_technology
SET MICROSCOPY_PATH=%OBIT_LIBS_PATH%\..\..\..\..\server\obit_microscopy_core_technology

REM ---------
REM FCSREADER
REM ---------

ECHO * * * Copying FCSReader to flow core technology...
CD %FLOW_PATH%\core-plugins\flow\1\dss\reporting-plugins\retrieve_fcs_events\lib\
DEL FCSReader_*.jar
COPY %OBIT_LIBS_PATH%\FCSReader\build\FCSReader_*.jar .

REM -------
REM LRCACHE
REM -------

ECHO * * * Copying LRCache to flow core technology...
CD %FLOW_PATH%\core-plugins\flow\1\dss\reporting-plugins\export_bdfacsdiva_datasets\lib\
DEL LRCache_*.jar
COPY %OBIT_LIBS_PATH%\LRCache\build\LRCache_*.jar .

ECHO * * * Copying LRCache to microscopy core technology...
CD %MICROSCOPY_PATH%\core-plugins\microscopy\1\dss\reporting-plugins\export_microscopy_datasets\lib\
DEL LRCache_*.jar
COPY %OBIT_LIBS_PATH%\LRCache\build\LRCache_*.jar .

REM -----------------
REM MICROSCOPY_READER
REM -----------------

ECHO * * * Copying MicroscopyReader to microscopy core technology...
CD %MICROSCOPY_PATH%\core-plugins\microscopy\1\dss\drop-boxes\MicroscopyDropbox\lib\
DEL MicroscopyReader_*.jar
COPY %OBIT_LIBS_PATH%\MicroscopyReader\build\MicroscopyReader_*.jar .

CD %OBIT_LIBS_PATH%\CopyClientLibsToCoreTechnologies

@ECHO OFF

REM Core technology versions
SET FLOW_VERSION=2
SET MICROSCOPY_VERSION=2

REM OBIT LIBS PATH
SET OBIT_LIBS_PATH=%CD%\..

REM SET THE PATH OF THE CORE-TECHNOLOGIES
SET FLOW_PATH=%OBIT_LIBS_PATH%\..\..\..\..\server\obit_flow_core_technology
SET MICROSCOPY_PATH=%OBIT_LIBS_PATH%\..\..\..\..\server\obit_microscopy_core_technology

REM ---------
REM FCSREADER
REM ---------

ECHO * * * Copying FCSReader to flow core technology...
CD %FLOW_PATH%\core-plugins\flow\%FLOW_VERSION%\dss\reporting-plugins\retrieve_fcs_events\lib\
DEL FCSReader_*.jar
COPY %OBIT_LIBS_PATH%\FCSReader\build\FCSReader_*.jar .

REM -------
REM LRCACHE
REM -------

ECHO * * * Copying LRCache to flow core technology...
CD %FLOW_PATH%\core-plugins\flow\%FLOW_VERSION%\dss\reporting-plugins\export_flow_datasets\lib\
DEL LRCache_*.jar
COPY %OBIT_LIBS_PATH%\LRCache\build\LRCache_*.jar .

ECHO * * * Copying LRCache to microscopy core technology...
CD %MICROSCOPY_PATH%\core-plugins\microscopy\%MICROSCOPY_VERSION%\dss\reporting-plugins\export_microscopy_datasets\lib\
DEL LRCache_*.jar
COPY %OBIT_LIBS_PATH%\LRCache\build\LRCache_*.jar .

REM -----------------
REM MICROSCOPY_READER
REM -----------------

ECHO * * * Copying MicroscopyReader to microscopy core technology...
CD %MICROSCOPY_PATH%\core-plugins\microscopy\%MICROSCOPY_VERSION%\dss\drop-boxes\MicroscopyDropbox\lib\
DEL MicroscopyReader_*.jar
COPY %OBIT_LIBS_PATH%\MicroscopyReader\build\MicroscopyReader_*.jar .

CD %OBIT_LIBS_PATH%\CopyClientLibsToCoreTechnologies

Fix CopyClientLibsToCoreTechnologies.bat script.


echo=off
set ssleay=%1%
set tmp1=pem.out
set cmp=fc.exe

call tpem.bat crl ..\test\testcrl.pem
if errorlevel 1 goto err

call tpem.bat pkcs7 ..\test\testp7.pem
if errorlevel 1 goto err

call tpem.bat req ..\test\testreq.pem
if errorlevel 1 goto err

call tpem.bat req ..\test\testreq2.pem
if errorlevel 1 goto err

call tpem.bat rsa ..\test\testrsa.pem
if errorlevel 1 goto err

call tpem.bat x509 ..\test\testx509.pem
if errorlevel 1 goto err

call tpem.bat x509 ..\test\v3-cert1.pem
if errorlevel 1 goto err

call tpem.bat x509 ..\test\v3-cert1.pem
if errorlevel 1 goto err

call tpem.bat sess_id ..\test\testsid.pem
if errorlevel 1 goto err

echo OK
del %tmp1%
:err

echo=off
set ssleay=%1%
set tmp1=pem.out
set cmp=fc.exe

call tpem.bat crl ..\test\testcrl.pem
if errorlevel 1 goto err

call tpem.bat pkcs7 ..\test\testp7.pem
if errorlevel 1 goto err

call tpem.bat req ..\test\testreq2.pem
if errorlevel 1 goto err

call tpem.bat rsa ..\test\testrsa.pem
if errorlevel 1 goto err

call tpem.bat x509 ..\test\testx509.pem
if errorlevel 1 goto err

call tpem.bat x509 ..\test\v3-cert1.pem
if errorlevel 1 goto err

call tpem.bat x509 ..\test\v3-cert1.pem
if errorlevel 1 goto err

call tpem.bat sess_id ..\test\testsid.pem
if errorlevel 1 goto err

echo OK
del %tmp1%
:err

Delete Win32 test with testreq.pem and req: there is already a test with testreq2.pem.


cd conda-skeletons
conda install conda-build anaconda-client
conda config --add channels matsci
conda config --set anaconda_upload yes
anaconda login --hostname travis-mavrl-win64-py35 --username %ANACONDA_USER% --password %ANACONDA_PASSWORD%
FOR %%A IN (latexcodec tabulate monty pybtex palettable spglib pydispatcher pymatgen) DO conda build %%A
cd ..

cd conda-skeletons
conda install conda-build anaconda-client
conda config --add channels matsci
conda config --set anaconda_upload yes
anaconda login --hostname travis-mavrl-win64-py35 --username %ANACONDA_USER% --password %ANACONDA_PASSWORD%
FOR %%A IN (latexcodec tabulate monty pybtex palettable spglib pydispatcher pymatgen) DO conda build --user matsci %%A
cd ..

Fix user.

Fix user.


dotnet new -i %~dp0
dotnet new --list
rem dotnet new dntidentity -n MyNewProj
pause

SET DNTPath=%~dp0
IF "%DNTPath:~-1%"=="\" SET DNTPath=%DNTPath:~0,-1%
dotnet new -u %DNTPath%
dotnet new -i %DNTPath%
dotnet new --list
rem dotnet new dntidentity -n MyNewProj
pause

update _register_template.bat

update _register_template.bat


@echo off
SET zip_file=php-gtk-0.5.0-win32.zip
md \php-gtk-dist
cd \php-gtk-dist
md php4
md winnt
md winnt\system32
md test
copy \php4\php.exe php4
copy \php4\php_win.exe php4
copy \php4\php4ts.dll php4
copy \php4\php4isapi.dll php4
copy \php4\php_gtk.dll php4
copy \php4\php_gtk_libglade.dll php4
copy \php4\php_gtk_sqpane.dll php4
copy \php\php4\php.ini-dist winnt\php.ini
type \php\php-gtk\win32\php.ini >>winnt\php.ini
copy %SystemRoot%\system32\gtk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gdk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gmodule-1.3.dll winnt\system32
copy %SystemRoot%\system32\glib-1.3.dll winnt\system32
copy %SystemRoot%\system32\iconv-1.3.dll winnt\system32
copy %SystemRoot%\system32\gnu-intl.dll winnt\system32
copy %SystemRoot%\system32\libglade-0.14.dll winnt\system32
copy %SystemRoot%\system32\libxml.dll winnt\system32
copy \php\php-gtk\test\fileselection.php test
copy \php\php-gtk\test\gtk.php test
copy \php\php-gtk\test\hello.php test
copy \php\php-gtk\test\list.php test
copy \php\php-gtk\test\scribble.php test
copy \php\php-gtk\test\testgtkrc test
copy \php\php-gtk\test\testgtkrc2 test
copy \php\php-gtk\win32\README.txt
copy \php\php-gtk\NEWS
"c:\Program Files\WinZip\WZZip" -ampr %zip_file%
copy %zip_file% \php\php-gtk-web\distributions
del %zip_file%
cd \php\php-gtk\win32

@echo off
SET zip_file=php-gtk-%1-win32.zip
md \php-gtk-dist
cd \php-gtk-dist
md php4
md winnt
md winnt\system32
md test
copy \php4\php.exe php4
copy \php4\php-cgi.exe php4
copy \php4\php_win.exe php4
copy \php4\php4ts.dll php4
copy \php4\php4isapi.dll php4
copy \php4\php_gtk.dll php4
copy \php4\php_gtk_libglade.dll php4
copy \php4\php_gtk_sqpane.dll php4
copy \php4\php_gtk_combobutton.dll php4
copy \php\php4\php.ini-dist winnt\php.ini
type \php\php-gtk\win32\php.ini >>winnt\php.ini
copy %SystemRoot%\system32\gtk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gdk-1.3.dll winnt\system32
copy %SystemRoot%\system32\gmodule-1.3.dll winnt\system32
copy %SystemRoot%\system32\glib-1.3.dll winnt\system32
copy %SystemRoot%\system32\iconv-1.3.dll winnt\system32
copy %SystemRoot%\system32\gnu-intl.dll winnt\system32
copy %SystemRoot%\system32\libglade-0.14.dll winnt\system32
copy %SystemRoot%\system32\libxml.dll winnt\system32
copy \php\php-gtk\test\fileselection.php test
copy \php\php-gtk\test\gtk.php test
copy \php\php-gtk\test\hello.php test
copy \php\php-gtk\test\list.php test
copy \php\php-gtk\test\scribble.php test
copy \php\php-gtk\test\testgtkrc test
copy \php\php-gtk\test\testgtkrc2 test
copy \php\php-gtk\win32\README.txt
copy \php\php-gtk\NEWS
"c:\Program Files\WinZip\WZZip" -ampr %zip_file%
copy %zip_file% \php\php-gtk-web\distributions
del %zip_file%
cd \php\php-gtk\win32

Modify script for easy versioning and adding ComboButton to the distribution.


:: run command bellow before first run:
:: npm install node-debug

node-debug server.js

debug mode run

debug mode run


@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\VanillaTransformer\VanillaTransformer.csproj /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=diag /nr:false
xcopy  "Src\VanillaTransformer\bin\%config%" "Nuget\tools\" /s/h/e/k/f/c/Y

%nuget% pack "Nuget\VanillaTransformer.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 Src\VanillaTransformer\VanillaTransformer.csproj /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=diag /nr:false
xcopy  "Src\VanillaTransformer\bin\%config%" "Nuget\tools\" /s/h/e/k/f/c/Y

mkdir Build

%nuget% pack "Nuget\VanillaTransformer.nuspec" -NoPackageAnalysis -verbosity detailed -o Build -Version %version% -p Configuration="%config%"

Fix build script

Fix build script


@rem Copyright 2019 Google Inc. All Rights Reserved.
@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.

@setlocal
@echo off

@rem This is a convenience wrapper for recording heap snapshots for
@rem investigating heap memory leaks, as discussed here:
@rem https://docs.microsoft.com/en-us/windows-hardware/test/wpt/record-heap-snapshot
@rem You run this script and pass it the pid of the process of interest,
@rem or a path to a process that you want started. Note that if this batch file
@rem starts a process then it will, necessarily, be run as administrator, and
@rem some initial allocations will be missed.
@rem You can start recording heap data anytime you want, but right at
@rem process startup is one obvious time. wpr will also let you specify the
@rem process of interest by name but that works poorly with Chrome
@rem and its dozens of processes and it is not supported by this script.
@rem When the script runs it tells the specified process to start recording
@rem call stacks for all outstanding memory allocations. When you hit
@rem enter a snapshot of this data is recorded into an ETW trace. You then have
@rem the option to record subsequent traces (one snapshot each) or exit and
@rem disable heap snapshots. Note that it is quite possible to put multiple
@rem snapshots in one file, but this script does not support this.

@rem Set the etwtracedir environment variable if it isn't set already.
@if not "%etwtracedir%" == "" goto TraceDirSet
@set etwtracedir=%homedrive%%homepath%\documents\etwtraces
:TraceDirSet

@rem Make sure %etwtracedir% exists
@if exist "%etwtracedir%" goto TraceDirExists
@mkdir "%etwtracedir%"
:TraceDirExists

if not "%1" == "" goto hasarg
@echo Required argument is missing. Specify a PID or a path to an executable
@echo to launch.
@exit /b
:hasarg

@rem See if %1 is a PID or a process path, start a process if needed, put the
@rem pid in %pid%. Note that if we start the process here then the first few
@rem allocations will be missed. Start the process with DelayedCreateProcess.exe
@rem in another command prompt and then (quickly) run this batch file with the
@rem pid if you want to avoid this.
set pid=none
set "var="&for /f "delims=0123456789" %%i in ("%1") do @set var=%%i
if defined var (
    FOR /f "usebackq tokens=*" %%a in (`DelayedCreateProcess.exe "%*" 0`) do set pid=%%a
    ) else (
    set pid=%1
    )

@rem Exit if CreateProcess failed
if %pid%==none exit /b

@echo Starting at %date%, %time%

@rem Enable echo so that users can see the commands that are being run.
@echo on

@rem Tell the process to start recording stacks on all subsequent outstanding
@rem allocations.
wpr -snapshotconfig heap -pid %pid% enable

@echo Run your scenario and hit any non-'q' key when you want a snapshot saved.
@echo You can stay in this state for as long as you want - days if desired -
@echo but performance of the target process may be worse during this time.
:WaitAgain
@set /p quit=Type 'q' and enter if you want to quit, or enter to save a snapshot:
@if "%quit%"=="q" goto leave

@rem Generate a file name based on the current date and time and put it in
@rem etwtracedir. This is compatible with UIforETW which looks for traces there.
@rem Note: this probably fails in some locales. Sorry.
@for /F "tokens=2-4 delims=/- " %%A in ('date/T') do @set datevar=%%C-%%A-%%B
@for /F "tokens=1-3 delims=:-. " %%A in ('echo %time%') do @set timevar=%%A-%%B-%%C&set hour=%%A
@rem Make sure that morning hours such as 9:00 are handled as 09 rather than 9
@if %hour% LSS 10 set timevar=0%timevar%
@set FileName=%etwtracedir%\%datevar%_%timevar% %username% heapsnapshot %pid%.etl
@echo Trace will be saved to %FileName%

@rem Don't start tracing until we are ready to do the snapshot.
@rem This avoids filling the trace with GB of process-create
@rem events that we don't care about.
wpr -start heapsnapshot -filemode
wpr -singlesnapshot heap %pid%
wpr -stop "%temp%\UIforETW_heap_snapshot.etl"
@rem Merging the trace ensures that machine-specific data is pulled in, and
@rem gives an opportunity to compress the trace.
xperf -merge "%temp%\UIforETW_heap_snapshot.etl" "%FileName%" -compress
@if not %errorlevel% equ 0 goto noxperf
del "%temp%\UIforETW_heap_snapshot.etl"
@goto xperf_worked
:noxperf
@echo xperf.exe failed (or wasn't found). Skipping merge step. Trace may not work.
move "%temp%\UIforETW_heap_snapshot.etl" "%FileName%"
:xperf_worked
@echo Trace data is in %FileName% -- load it with wpa or xperfview or gpuview.
@dir "%FileName%" | find /i ".etl"

@goto WaitAgain

:leave
@rem When we are done, turn off heap tracing for this process.
wpr -snapshotconfig heap -pid %pid% disable

@rem Copyright 2019 Google Inc. All Rights Reserved.
@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.

@setlocal
@echo off

@rem This is a convenience wrapper for recording heap snapshots for
@rem investigating heap memory leaks, as discussed here:
@rem https://docs.microsoft.com/en-us/windows-hardware/test/wpt/record-heap-snapshot
@rem You run this script and pass it the pid of the process of interest,
@rem or a path to a process that you want started. Note that if this batch file
@rem starts a process then it will, necessarily, be run as administrator, and
@rem some initial allocations will be missed.
@rem You can start recording heap data anytime you want, but right at
@rem process startup is one obvious time. wpr will also let you specify the
@rem process of interest by name but that works poorly with Chrome
@rem and its dozens of processes and it is not supported by this script.
@rem When the script runs it tells the specified process to start recording
@rem call stacks for all outstanding memory allocations. When you hit
@rem enter a snapshot of this data is recorded into an ETW trace. You then have
@rem the option to record subsequent traces (one snapshot each) or exit and
@rem disable heap snapshots. Note that it is quite possible to put multiple
@rem snapshots in one file, but this script does not support this.

@rem Set the etwtracedir environment variable if it isn't set already.
@if not "%etwtracedir%" == "" goto TraceDirSet
@set etwtracedir=%homedrive%%homepath%\documents\etwtraces
:TraceDirSet

@rem Make sure %etwtracedir% exists
@if exist "%etwtracedir%" goto TraceDirExists
@mkdir "%etwtracedir%"
:TraceDirExists

if not "%1" == "" goto hasarg
@echo Required argument is missing. Specify a PID or a path to an executable
@echo to launch.
@exit /b
:hasarg

@rem See if %1 is a PID or a process path, start a process if needed, put the
@rem pid in %pid%. Note that if we start the process here then the first few
@rem allocations will be missed. Start the process with DelayedCreateProcess.exe
@rem in another command prompt and then (quickly) run this batch file with the
@rem pid if you want to avoid this.
set pid=none
set "var="&for /f "delims=0123456789" %%i in ("%1") do @set var=%%i
if defined var (
    FOR /f "usebackq tokens=*" %%a in (`DelayedCreateProcess.exe "%*" 0`) do set pid=%%a
    ) else (
    set pid=%1
    )

@rem Exit if CreateProcess failed
if %pid%==none exit /b

@echo Starting at %date%, %time%

@rem Enable echo so that users can see the commands that are being run.
@echo on

@rem Tell the process to start recording stacks on all subsequent outstanding
@rem allocations.
wpr -snapshotconfig heap -pid %pid% enable

@echo Run your scenario and hit any non-'q' key when you want a snapshot saved.
@echo You can stay in this state for as long as you want - days if desired -
@echo but performance of the target process may be worse during this time.
:WaitAgain
@set /p quit=Type 'q' and enter if you want to quit, or enter to save a snapshot:
@if "%quit%"=="q" goto leave

@rem Generate a file name based on the current date and time and put it in
@rem etwtracedir. This is compatible with UIforETW which looks for traces there.
@rem Adapted from https://superuser.com/a/1287820
@rem get the date in locale independent way
@rem use findstr to strip blank lines from wmic output
@for /f "usebackq skip=1 tokens=1-3" %%g in (`wmic Path Win32_LocalTime Get Day^,Month^,Year ^| findstr /r /v "^$"`) do @set _day=00%%g&set _month=00%%h&set _year=%%i
@rem pad day and month with leading zeros
@set _month=%_month:~-2%
@set _day=%_day:~-2%
@set datevar=%_year%-%_month%-%_day%

@for /F "tokens=1-3 delims=:-. " %%A in ('echo %time%') do @set timevar=%%A-%%B-%%C&set hour=%%A
@rem Make sure that morning hours such as 9:00 are handled as 09 rather than 9
@if %hour% LSS 10 set timevar=0%timevar%
@set FileName=%etwtracedir%\%datevar%_%timevar% %username% heapsnapshot %pid%.etl
@echo Trace will be saved to %FileName%

@rem Don't start tracing until we are ready to do the snapshot.
@rem This avoids filling the trace with GB of process-create
@rem events that we don't care about.
wpr -start heapsnapshot -filemode
wpr -singlesnapshot heap %pid%
wpr -stop "%temp%\UIforETW_heap_snapshot.etl"
@rem Merging the trace ensures that machine-specific data is pulled in, and
@rem gives an opportunity to compress the trace.
xperf -merge "%temp%\UIforETW_heap_snapshot.etl" "%FileName%" -compress
@if not %errorlevel% equ 0 goto noxperf
del "%temp%\UIforETW_heap_snapshot.etl"
@goto xperf_worked
:noxperf
@echo xperf.exe failed (or wasn't found). Skipping merge step. Trace may not work.
move "%temp%\UIforETW_heap_snapshot.etl" "%FileName%"
:xperf_worked
@echo Trace data is in %FileName% -- load it with wpa or xperfview or gpuview.
@dir "%FileName%" | find /i ".etl"

@goto WaitAgain

:leave
@rem When we are done, turn off heap tracing for this process.
wpr -snapshotconfig heap -pid %pid% disable

Fix the locale dependent date parsing used for the output heap trace filename

date/T prints the date in locale-dependent format and thus causes issues when being parsed.
wmic command works independently of OS locale, language or the user's chosen date format.


@echo off

if not exist "genie.exe" (
	echo Downloading genie...
	bitsadmin /transfer "genie" "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" "%~dp0\genie.exe"
)

genie.exe %*

@echo off

if not exist "genie.exe" (
	echo Downloading genie...
	bitsadmin /transfer "genie" "https://github.com/bkaradzic/bx/raw/master/tools/bin/windows/genie.exe" "%~dp0\genie.exe"
)

IF "%1"=="" (
	echo No argument set
	echo Exemple : build.bat vs2015
	exit 1
)

genie.exe %*

Add message in build.bat when no argument is set


cd %~dp0
set CONDA_BLD_PATH=%cd%\..\output

call:cb %* .\descartes || exit /B 1
call:cb %* .\geopandas || exit /B 1
call:cb %* .\motionless || exit /B 1
call:cb %* .\salem || exit /B 1
call:cb %* .\cleo || exit /B 1
call:cb %* .\oggm || exit /B 1

pause
exit /B %ERRORLEVEL%

:cb
conda build --no-anaconda-upload --python 3.4 --channel defaults --channel ioos --channel oggm --override-channels %* || exit /B 1
exit /B 0

cd %~dp0
set CONDA_BLD_PATH=%cd%\..\output

call:cb %* .\descartes || exit /B 1
call:cb %* .\geopandas || exit /B 1
call:cb %* .\motionless || exit /B 1
call:cb %* .\salem || exit /B 1
call:cb %* .\cleo || exit /B 1
call:cb %* .\oggm || exit /B 1

exit /B %ERRORLEVEL%

:cb
conda build --no-anaconda-upload --python 3.4 --channel defaults --channel ioos --channel oggm --override-channels %* || exit /B 1
exit /B 0

Remove forgotten pause call

Remove forgotten pause call


@echo off

md ..\lib\

xcopy /Y "..\out\libraries\xeumeuleu\vc71\release\xeumeuleu.lib" ..\lib\
xcopy /Y "..\out\libraries\xeumeuleu\vc71\debug\xeumeuleu_d.lib" ..\lib\

set INCLUDE_DIR=..\include\xeumeuleu
md %INCLUDE_DIR%

set SRC_DIR=..\src\libraries\xeumeuleu

xcopy /Y "%SRC_DIR%\xml.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\exception.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\xo*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\xi*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\encoding.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\grammar.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\start.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\end.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\content.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\cdata.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\attribute.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\filter.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\adapter.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\list.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\name_list.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\attributes.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\visitor.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\caller*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\name_caller*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\optional.h" %INCLUDE_DIR%

@echo off

md ..\lib\

xcopy /Y "..\out\libraries\xeumeuleu\vc71\release\xeumeuleu.lib" ..\lib\vc71\
xcopy /Y "..\out\libraries\xeumeuleu\vc71\debug\xeumeuleu_d.lib" ..\lib\vc71\
xcopy /Y "..\out\libraries\xeumeuleu\vc80\release\xeumeuleu.lib" ..\lib\vc80\
xcopy /Y "..\out\libraries\xeumeuleu\vc80\debug\xeumeuleu_d.lib" ..\lib\vc80\

set INCLUDE_DIR=..\include\xeumeuleu
md %INCLUDE_DIR%

set SRC_DIR=..\src\libraries\xeumeuleu

xcopy /Y "%SRC_DIR%\xml.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\exception.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\xo*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\xi*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\encoding.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\grammar.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\start.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\end.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\content.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\cdata.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\attribute.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\filter.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\adapter.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\list.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\name_list.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\attributes.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\visitor.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\caller*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\name_caller*.h" %INCLUDE_DIR%
xcopy /Y "%SRC_DIR%\optional.h" %INCLUDE_DIR%

Support for both vc71 and vc80

Support for both vc71 and vc80


if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python35_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python34_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

revert to python 3.4 build_script.bat

revert to python 3.4 build_script.bat


if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python36_x64\python"
:custom_python:
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

@echo off
if "%1"=="" goto default_value_python:
set pythonexe="%1"
%pythonexe% setup.py write_version
goto custom_python:

:default_value_python:
set pythonexe="c:\Python363_x64\python"
if not exist %pythonexe% set pythonexe="c:\Python36_x64\python"
:custom_python:
@echo [python] %pythonexe%
%pythonexe% -u setup.py build_script
if %errorlevel% neq 0 exit /b %errorlevel%

update script

update script


:: android_background_ignore
:: Jack
::汾 V0.2
::Ŀַ https://github.com/Jiangyiqun/android_background_ignore
@echo off
cls
if not exist white_list.txt (
	echo.
	echo ûҵ white_list.txt ļ,µַ
	echo https://github.com/Jiangyiqun/android_background_ignore
	echo  android_background_ignore.bat ͬ·
	echo.
	pause
)

echo.
echo ˵
echo 1ƵAPPԶ
echo 2Ҫ ROOT
echo 3 Android 7.0 +
echo.
echo ׼裺
echo 1԰װ ADB
echo 2԰װ Universal Android USB driver
echo 3ֻ USB
echo.
echo  https://zhuanlan.zhihu.com/p/23372646
echo.
pause
adb devices
echo ĻӦʾ "CVH7N0000000000        device" ִ
echo ȷȷ¼׼
echo.
pause

echo.
echo ܲ˵
echo 1Զ
echo 2ָĬģʽ
set /p choice=ѡ
if "%choice%"=="1" goto plan_1
if "%choice%"=="2" goto plan_2

:plan_1
echo.
echo Զѣ
adb shell pm list packages -3 > apps_list.txt
for /f "tokens=2 delims=:" %%i in (apps_list.txt) do (
	echo  %%i Զ
	adb shell cmd appops set %%i RUN_IN_BACKGROUND ignore
)
del apps_list.txt

echo.
echo ڴ(Ըòеı

if exist white_list.txt (
	echo.
	for /f "eol=#" %%i in (white_list.txt) do (
	echo ڻָ %%i ΪĬ״̬
	adb shell cmd appops set %%i RUN_IN_BACKGROUND allow
	)
)

if not exist white_list.txt (
	echo.
	echo ûҵwhite_list.txtļ,
	goto plan_end
)
goto plan_end

:plan_2
echo.
echo ڻָĬģʽ
adb shell pm list packages -3 > apps_list.txt
for /f "tokens=2 delims=:" %%i in (apps_list.txt) do (
	echo ڻָ %%i ΪĬ״̬
	adb shell cmd appops set %%i RUN_IN_BACKGROUND allow
)
del apps_list.txt
goto plan_end

:plan_end
echo.
echo ѾɣرUSB
echo.
pause

::名称 android_background_ignore
::作者 白兔Jack
::版本 V0.2
::项目地址 https://github.com/Jiangyiqun/android_background_ignore

@echo off
cls
if not exist white_list.txt (
	echo.
	echo 没有找到 white_list.txt 文件,请从如下地址下载
	echo https://github.com/Jiangyiqun/android_background_ignore
	echo 并拷贝至与 android_background_ignore.bat 相同路径下
	echo.
	pause
)

echo.
echo 功能说明：
echo 1、可限制第三方APP的自动唤醒
echo 2、不需要 ROOT
echo 3、必须是 Android 7.0 +
echo.
echo 准备步骤：
echo 1、电脑安装 ADB
echo 2、电脑安装 Universal Android USB driver
echo 3、手机开启 USB 调试
echo.
echo 详见 https://zhuanlan.zhihu.com/p/23372646
echo.
pause
adb devices
echo 屏幕应当显示类似 "CVH7N0000000000        device" 的字串
echo 确认正确请继续，否则请重新检查准备步骤
echo.
pause

echo.
echo 功能菜单：
echo 1、限制自动唤醒
echo 2、恢复默认模式
set /p choice=请选择：
if "%choice%"=="1" goto plan_1
if "%choice%"=="2" goto plan_2

:plan_1
echo.
echo 正在限制自动唤醒：
adb shell pm list packages -3 > apps_list.txt
for /f "tokens=2 delims=:" %%i in (apps_list.txt) do (
	echo 正在限制 %%i 的自动唤醒
	adb shell cmd appops set %%i RUN_IN_BACKGROUND ignore
)
del apps_list.txt

echo.
echo 正在处理白名单(请忽略该步骤中的报错）：

if exist white_list.txt (
	echo.
	for /f "eol=#" %%i in (white_list.txt) do (
	echo 正在恢复 %%i 为默认状态
	adb shell cmd appops set %%i RUN_IN_BACKGROUND allow
	)
)

if not exist white_list.txt (
	echo.
	echo 没有找到white_list.txt文件,跳过处理白名单
	goto plan_end
)
goto plan_end

:plan_2
echo.
echo 正在恢复默认模式：
adb shell pm list packages -3 > apps_list.txt
for /f "tokens=2 delims=:" %%i in (apps_list.txt) do (
	echo 正在恢复 %%i 为默认状态
	adb shell cmd appops set %%i RUN_IN_BACKGROUND allow
)
del apps_list.txt
goto plan_end

:plan_end
echo.
echo 已经完成，请关闭USB调试
echo.
pause

change encode

change encode