批处理单独运行正常,但被Winrar自解压文件调用后无效果

查看 22|回复 0
作者:冬瓜小野鸭   
这是一段修改hosts文件屏蔽某些软件联网的批处理,批处理用管理员权限调取头部,正常运行可以修改并隐藏hosts文件,但用winrar打包成解压缩文件调用运行无效,求解
[Asm] 纯文本查看 复制代码@ECHO OFF
set /a _Debug=0
::================================================================================================
:: Run Script as Administrator
set _Args=%*
if "%~1" NEQ "" (
  set _Args=%_Args:"=%
)
fltmc 1>nul 2>nul || (
  cd /d "%~dp0"
  cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~dp0"" && ""%~dpnx0"" ""%_Args%""", "", "runas", 1 > "%temp%\GetAdmin.vbs"
  "%temp%\GetAdmin.vbs"
  del /f /q "%temp%\GetAdmin.vbs" 1>nul 2>nul
  exit
)
::================================================================================================
CLS
ECHO.
ECHO  - Piriform Blocker Key Verificator...
ECHO.
ECHO  - Editing the hosts file with string "127.0.0.1  license.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  www.license.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  speccy.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  www.speccy.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  recuva.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  www.recuva.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  defraggler.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  www.defraggler.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  ccleaner.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  www.ccleaner.piriform.com"
ECHO  - Editing the hosts file with string "127.0.0.1  license-api.ccleaner.com"
takeown /f "%SystemRoot%\System32\drivers\etc\hosts" /a
icacls "%SystemRoot%\System32\drivers\etc\hosts" /grant administrators:F
attrib -h -r -s "%SystemRoot%\System32\drivers\etc\hosts"
SET NEWLINE=^& echo.
FIND /C /I "# Piriform Blocker Key Verificator" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^# Piriform Blocker Key Verificator>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "license.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  license.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "www.license.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  www.license.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "speccy.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  speccy.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "www.speccy.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  www.speccy.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "recuva.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  recuva.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "www.recuva.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  www.recuva.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "defraggler.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  defraggler.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "www.defraggler.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  www.defraggler.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "ccleaner.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  ccleaner.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "www.ccleaner.piriform.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  www.ccleaner.piriform.com>>%WINDIR%\system32\drivers\etc\hosts
SET NEWLINE=^& echo.
FIND /C /I "license-api.ccleaner.com" %WINDIR%\system32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1  license-api.ccleaner.com>>%WINDIR%\system32\drivers\etc\hosts
attrib +h +r +s "%SystemRoot%\system32\drivers\etc\hosts"

批处理, 文件

您需要登录后才可以回帖 登录 | 立即注册

返回顶部