@ECHO OFF & PUSHD "%~DP0" && CD /D "%~DP0"
IF EXIST "%Public%" >NUL 2>&1 REG QUERY "HKU\S-1-5-19\Environment"
IF NOT %errorlevel% EQU 0 (
IF EXIST "%Public%" powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
EXIT
)

taskkill /f /im Xftp* >NUL 2>NUL
taskkill /f /im Xshell* >NUL 2>NUL

regsvr32 /s /u NsCopyHook3.dll
rmdir/s/q "%ProgramData%\NetSarang" 2>NUL
rmdir/s/q "%AllUsersProfile%\NetSarang\Xftp"2>NUL
rmdir/s/q "%AllUsersProfile%\NetSarang\Xshell"2>NUL
del/f/q "%PUBLIC%\Desktop\Xftp.lnk" >NUL 2>NUL
del/f/q "%UserProfile%\Desktop\ftp.lnk" >NUL 2>NUL
del/f/q "%AllUsersProfile%\Desktop\ftp.lnk" >NUL 2>NUL
del/f/q "%PUBLIC%\Desktop\Xshell.lnk" >NUL 2>NUL
del/f/q "%UserProfile%\Desktop\Xshell.lnk" >NUL 2>NUL
del/f/q "%AllUsersProfile%\Desktop\Xshell.lnk" >NUL 2>NUL

reg delete "HKCU\Software\NetSarang\Xftp" /F>NUL 2>NUL
reg delete "HKCU\Software\NetSarang\Xshell" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\NetSarang\Xftp" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\NetSarang\Xshell" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\NetSarang\Common" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xftp" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\NetSarang\Xshell" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\NetSarang\Common" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%~dp0XshellCore.tlb" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%~dp0NsCopyHook3.dll" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%~dp0XshellCore.tlb" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%~dp0NsCopyHook3.dll" /f >NUL 2>NUL

reg delete "HKCR\.xfp" /f >NUL 2>NUL
reg delete "HKCR\.xts" /f >NUL 2>NUL
reg delete "HKCR\.xsh" /f >NUL 2>NUL
reg delete "HKCR\Xftp.xfp" /f >NUL 2>NUL
reg delete "HKCR\Xshell.xsh" /f >NUL 2>NUL
reg delete "HKCR\Xtransport.xts" /f >NUL 2>NUL

reg delete "HKLM\SOFTWARE\Classes\.xsh" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\.xts" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{28CDE56E-0823-4779-846E-EF8279D08F48}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{3C46F82A-A7E8-411D-8CBD-348A8F637DEB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{412941DD-D839-4F04-964A-B848505BED0F}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{6C51A006-7BBF-4CB5-97BA-BE817AE8F676}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{C5F52903-5CCF-4045-A3FD-38C96AFEE001}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{E07D3360-0EB9-40CF-97BD-C3FD867F76DB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{F9BEB160-712F-4DEE-AF53-6920B63D699B}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\TypeLib\{76F8E8FE-E047-44E6-80B1-302E70CB6B27}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{28CDE56E-0823-4779-846E-EF8279D08F48}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{3C46F82A-A7E8-411D-8CBD-348A8F637DEB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{412941DD-D839-4F04-964A-B848505BED0F}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{6C51A006-7BBF-4CB5-97BA-BE817AE8F676}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{C5F52903-5CCF-4045-A3FD-38C96AFEE001}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{E07D3360-0EB9-40CF-97BD-C3FD867F76DB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{F9BEB160-712F-4DEE-AF53-6920B63D699B}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Xshell.xsh" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Xtransport.xts" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Xshell.Document" /F>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xactivator.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xagent.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xshell.exe" /f >NUL 2>NUL

reg delete "HKLM\SOFTWARE\Classes\.xfp" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\CLSID\{037DA433-DCF0-480e-9A61-DCE5F59F1F7D}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Directory\shellex\CopyHookHandlers\NsCopyHookHandler3" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{28CDE56E-0823-4779-846E-EF8279D08F48}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{3C46F82A-A7E8-411D-8CBD-348A8F637DEB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{412941DD-D839-4F04-964A-B848505BED0F}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{6C51A006-7BBF-4CB5-97BA-BE817AE8F676}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{C5F52903-5CCF-4045-A3FD-38C96AFEE001}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{C65D86CD-DD0E-4D60-824B-062863FBD183}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{E07D3360-0EB9-40CF-97BD-C3FD867F76DB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Interface\{F9BEB160-712F-4DEE-AF53-6920B63D699B}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\NsCopyHook.NsCopyHookHandler3" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\NsCopyHook.NsCopyHookHandler3.1" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\TypeLib\{6CA23E2A-035A-40B1-B577-C96BEEE94DB5}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\TypeLib\{76F8E8FE-E047-44E6-80B1-302E70CB6B27}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{037DA433-DCF0-480E-9A61-DCE5F59F1F7D}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{28CDE56E-0823-4779-846E-EF8279D08F48}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{3C46F82A-A7E8-411D-8CBD-348A8F637DEB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{412941DD-D839-4F04-964A-B848505BED0F}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{6C51A006-7BBF-4CB5-97BA-BE817AE8F676}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{C5F52903-5CCF-4045-A3FD-38C96AFEE001}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{C65D86CD-DD0E-4D60-824B-062863FBD183}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{E07D3360-0EB9-40CF-97BD-C3FD867F76DB}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Wow6432Node\Interface\{F9BEB160-712F-4DEE-AF53-6920B63D699B}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Xftp.xfp" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Xshell.xsh" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Classes\Xtransport.xts" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xactivator.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xagent.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xftp.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Xshell.exe" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" /v "{037DA433-DCF0-480e-9A61-DCE5F59F1F7D}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%~dp0NsCopyHook3.dll" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\SharedDlls" /v "%~dp0XshellCore.tlb" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" /v "{037DA433-DCF0-480e-9A61-DCE5F59F1F7D}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{2D76AF66-6E44-4AD8-91B4-CBD509588E99}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{EB1AAB19-5EE8-46BD-86CC-146BF85DC170}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{2D76AF66-6E44-4AD8-91B4-CBD509588E99}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{EB1AAB19-5EE8-46BD-86CC-146BF85DC170}" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\NetSarang\Xftp" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\WOW6432Node\NetSarang\Xshell" /f >NUL 2>NUL

reg delete "HKCR\.xsh" /f >NUL 2>NUL
reg delete "HKCR\.xts" /f >NUL 2>NUL
reg delete "HKCR\Xshell.xsh" /f >NUL 2>NUL
reg delete "HKCR\Xtransport.xts" /f >NUL 2>NUL
reg delete "HKCR\Interface\{28CDE56E-0823-4779-846E-EF8279D08F48}" /f >NUL 2>NUL
reg delete "HKCR\Interface\{3C46F82A-A7E8-411D-8CBD-348A8F637DEB}" /f >NUL 2>NUL
reg delete "HKCR\Interface\{412941DD-D839-4F04-964A-B848505BED0F}" /f >NUL 2>NUL
reg delete "HKCR\Interface\{6C51A006-7BBF-4CB5-97BA-BE817AE8F676}" /f >NUL 2>NUL
reg delete "HKCR\Interface\{C5F52903-5CCF-4045-A3FD-38C96AFEE001}" /f >NUL 2>NUL
reg delete "HKCR\Interface\{E07D3360-0EB9-40CF-97BD-C3FD867F76DB}" /f >NUL 2>NUL
reg delete "HKCR\Interface\{F9BEB160-712F-4DEE-AF53-6920B63D699B}" /f >NUL 2>NUL
reg delete "HKCR\TypeLib\{76F8E8FE-E047-44E6-80B1-302E70CB6B27}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{28CDE56E-0823-4779-846E-EF8279D08F48}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{3C46F82A-A7E8-411D-8CBD-348A8F637DEB}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{412941DD-D839-4F04-964A-B848505BED0F}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{6C51A006-7BBF-4CB5-97BA-BE817AE8F676}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{C5F52903-5CCF-4045-A3FD-38C96AFEE001}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{E07D3360-0EB9-40CF-97BD-C3FD867F76DB}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\Interface\{F9BEB160-712F-4DEE-AF53-6920B63D699B}" /f >NUL 2>NUL
reg delete "HKCR\WOW6432Node\TypeLib\{76F8E8FE-E047-44E6-80B1-302E70CB6B27}" /f >NUL 2>NUL

ECHO.&ECHO 完成！是否删除默认保存数据？
ECHO.&ECHO 如果自定义的路径请手动删除。
ECHO.&ECHO 是请按任意键，否直接关闭呗！&PAUSE >NUL 2>NUL & CLS

for /f "skip=2 tokens=3 delims= " %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v personal') do (
       for /f "delims=*" %%j in ('echo %%i') do rd/s/q "%%j\NetSarang" 2>NUL)
for /f "skip=2 tokens=3 delims= " %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v personal') do (
       for /f "delims=*" %%j in ('echo %%i') do rd/s/q "%%j\NetSarang Computer" 2>NUL)
       
ECHO.&ECHO 完成！&PAUSE >NUL 2>NUL & EXIT