@ECHO OFF&PUSHD %~DP0
taskkill /f /im Xshell* >NUL 2>NUL

If "%PROCESSOR_ARCHITECTURE%"=="AMD64"  mkdir  "%CommonProgramFiles(x86)%\NetSarang"  2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" copy /y XshellCore.tlb "%CommonProgramFiles(x86)%\NetSarang" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" copy /y NsCopyHook3.dll "%CommonProgramFiles(x86)%\NetSarang">NUL 2>NUL

if "%PROCESSOR_ARCHITECTURE%"=="x86" mkdir "%CommonProgramFiles%\NetSarang" 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" copy /y XshellCore.tlb "%CommonProgramFiles%\NetSarang" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" copy /y NsCopyHook3.dll "%CommonProgramFiles%\NetSarang">NUL 2>NUL

:: 默认更改用户数据保存在当前目录下；
reg add HKCU\Software\NetSarang\Common\6 /f /v FirstDataFolder /t REG_DWORD /d 1 >NUL
reg add HKCU\Software\NetSarang\Common\6\UserData /f /v UserDataPath /d "%~dp0NetSarang Computer" >NUL

:: 核心信息,没这项注册表键值启动不了；
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xshell\6" /f /v Path /d "%~dp0\" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xshell\6" /f /v Version /d "6.0.0082" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xshell\6" /f /v ProductKey /d "101210-450789-147200" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xshell\6" /f /v MagicCode /t REG_BINARY /d "84591309950a228108b2735741ede69fe20704001900" >NUL 2>NUL

if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xftp\6" /f /v Path /d "%~dp0\" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xftp\6" /f /v Version /d "6.0.0076" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xftp\6" /f /v ProductKey /d "101210-450789-147200" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add "HKLM\SOFTWARE\NetSarang\Xftp\6" /f /v MagicCode /t REG_BINARY /d "84591309950a228108b2735741ede69fe20704001900" >NUL 2>NUL

If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xshell\6" /f /v Path /d "%~dp0\" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xshell\6" /f /v Version /d "6.0.0082" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xshell\6" /f /v ProductKey /d "101210-450789-147200" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xshell\6" /f /v MagicCode /t REG_BINARY /d "84591309950a228108b2735741ede69fe20704001900" >NUL 2>NUL

If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xftp\6" /f /v Path /d "%~dp0\" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xftp\6" /f /v Version /d "6.0.0076" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xftp\6" /f /v ProductKey /d "101210-450789-147200" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xftp\6" /f /v MagicCode /t REG_BINARY /d "84591309950a228108b2735741ede69fe20704001900" >NUL 2>NUL
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\Xshell.lnk""):b.TargetPath=""%~dp0Xshell.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\Xftp.lnk""):b.TargetPath=""%~dp0Xftp.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")