@echo off
if "%~1" == "h" goto :gotAdmin
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
   goto :UACPrompt
) else ( goto :gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "h", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del /f /q "%temp%\getadmin.vbs" )
set "iTag_OK=0"
if exist "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\SnapGene\SnapGene.lnk" (
     (echo,strFile = WScript.Arguments.Item^(0^)
     echo,ReadShortCut = CreateObject^("WScript.Shell"^).CreateShortcut^(strFile^).WorkingDirectory
     echo,WScript.Echo ReadShortCut
     )>"%tmp%\_TempVbsCode.vbs"
     for /f "delims=" %%a in ('cscript.exe /nologo "%tmp%\_TempVbsCode.vbs" "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\SnapGene\SnapGene.lnk"') do (
         copy /y "%~dp0centry.dll" "%%a" >nul
         copy /y "%~dp0sentry.dll" "%%a" >nul
         copy /y "%~dp0SnapGene.exe" "%%a" >nul
         set "iTag_OK=1"
     )
copy "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\SnapGene\SnapGene.lnk" "%userprofile%\desktop"
     del /f /q "%tmp%\_TempVbsCode.vbs" >nul
)
if %iTag_OK% equ 1 (
   echo,&echo, successfully copy file's
) else (
   echo,&echo, Error
)
pause>nul&exit
