@ECHO OFF&(PUSHD "%~DP0")&(REG QUERY "HKU\S-1-5-19">NUL 2>&1)||(
powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&EXIT)

if /i %PROCESSOR_IDENTIFIER:~0,3%==x86 (
reg add "HKLM\SOFTWARE\NSIS" /f /ve /d "%~dp0\" >NUL 2>NUL
reg add "HKLM\SOFTWARE\NSIS" /f /v "DisplayName" /d "NSIS" >NUL 2>NUL
) else (
reg add "HKLM\SOFTWARE\WOW6432Node\NSIS" /f /ve /d "%~dp0" >NUL 2>NUL
reg add "HKLM\SOFTWARE\WOW6432Node\NSIS" /f /v "DisplayName" /d "NSIS" >NUL 2>NUL
reg add "HKLM\SOFTWARE\WOW6432Node\NSIS" /f /v "VersionBuild" /t REG_DWORD /d "0" >NUL 2>NUL
reg add "HKLM\SOFTWARE\WOW6432Node\NSIS" /f /v "VersionMajor" /t REG_DWORD /d "3" >NUL 2>NUL
reg add "HKLM\SOFTWARE\WOW6432Node\NSIS" /f /v "VersionMinor" /t REG_DWORD /d "8" >NUL 2>NUL
reg add "HKLM\SOFTWARE\WOW6432Node\NSIS" /f /v "VersionRevision" /t REG_DWORD /d "1" >NUL 2>NUL
)
reg add "HKLM\SOFTWARE\Classes\.nsh" /f /ve /d "NSIS.Header" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\.nsh" /f /v "PerceivedType" /d "text" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\.nsh\ShellNew" /f /v "FileName" /d "%~dp0Include\test.nsh" >NUL 2>NUL

reg add "HKLM\SOFTWARE\Classes\.nsi" /f /ve /d "NSIS.Script" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\.nsi" /f /v "PerceivedType" /d "text" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\.nsi\ShellNew" /f /v "FileName" /d "%~dp0Include\test.nsh" >NUL 2>NUL

reg add "HKLM\SOFTWARE\Classes\NSIS.Header" /f /ve /d "NSIS 头文件" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Header\DefaultIcon" /f /ve /d "%~dp0makensisw.exe,2" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Header\shell" /f /ve /d "open" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Header\shell\open\command" /f /ve /d "\"%~dp0VNISEdit\VNISEdit.exe\" \"%%1\"" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.LangFile\shell\open\command" /f /ve /d "\"%~dp0VNISEdit\VNISEdit.exe\" \"%%1\"" >NUL 2>NUL

reg add "HKLM\SOFTWARE\Classes\NSIS.Script" /f /ve /d "NSIS 脚本文件" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\DefaultIcon" /f /ve /d "%~dp0makensisw.exe,1" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\shell" /f /ve /d "open" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\shell\compile" /f /ve /d "编译 NSIS 脚本" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\shell\compile\command" /f /ve /d "\"%~dp0makensisw.exe\" \"%%1\"" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\shell\compile-compressor" /f /ve /d "编译 NSIS 脚本 (选择压缩器)" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\shell\compile-compressor\command" /f /ve /d "\"%~dp0makensisw.exe\" /ChooseCompressor \"%%1\"" >NUL 2>NUL
reg add "HKLM\SOFTWARE\Classes\NSIS.Script\shell\open\command" /f /ve /d "\"%~dp0VNISEdit\VNISEdit.exe\" \"%%1\"" >NUL 2>NUL


assoc .=.file >NUL 2>NUL

echo y|icacls "%~dp0\" /c /t /grant "Everyone:(OI)(CI)(F)" >NUL 2>NUL

mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\NSIS.lnk""):b.TargetPath=""%~dp0NSIS.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")

Exit
