@echo off

Md "%WinDir%\System32\test_permissions" 2>NUL||(Echo 请使用右键管理员身份运行&&Pause >NUL&&Exit)
Rd "%WinDir%\System32\test_permissions" 2>NUL

cd /d "%~dp0"
set home=%~dp0home
REG ADD "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" /v SCM_HOME /d "%HOME%" /f
bin\RefreshEnvironment.exe

if not exist "%home%\config" xcopy template\config\* "%home%\config\"
if not exist "%home%\config\svn.xml" cscript /NoLogo bin\initconfig.vbs "%~dp0\template\svn.xml" "%home%\config\svn.xml" "%home%"
if not exist "%home%\config\git.xml" cscript /NoLogo bin\initconfig.vbs "%~dp0\template\git.xml" "%home%\config\git.xml" "%home%"
if not exist "%home%\config\hg.xml" cscript /NoLogo bin\initconfig.vbs "%~dp0\template\hg.xml" "%home%\config\hg.xml" "%home%"
if not exist "%home%\config\config.xml" copy "%~dp0\template\config.xml" "%home%\config\config.xml"
