- 帖子
- 2
- 积分
- 14
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2015-11-3
|
[其他] 新人求助,bat 打开1.BAT 后2.BAT 无法自动关闭
大家好,我是新人,遇到一个问题,希望大家帮忙
问题如标题,即使用 BAT 也无法关闭,代码如下,求救
@echo off
:loop
start C:\Users\Administrator.PC-20140211HALN\Desktop\1.bat
call:sleep 10000
taskkill /FI "WINDOWTITLE eq 1.bat" /IM cmd.exe /F
call:sleep 8000
goto:loop
:sleep
set tmp="%temp%\tmp.vbs"
echo wscript.sleep %1>%tmp%&%tmp%&del %tmp%
goto :eof
::调用方法call:sleep [毫秒] (1秒=1000毫秒)
1.bat 的代码如下(网上找到自动截屏代码 )
@echo off & title 1.bat
set "dnfpath=%systemroot%\Microsoft.NET\Framework"
for /f "delims=" %%v in ('dir /ad /b %dnfpath%\v?.*') do (
if exist "%dnfpath%\%%v\csc.exe" set "cscpath=%dnfpath%\%%v\csc.exe"
)
< "%~f0" more +15 > "%temp%\estCapture.cs"
%cscpath% /out:"%cd%\estCapture.exe" "%temp%\estCapture.cs" 1>nul
estCapture.exe
ping -n 2 127.1 1>nul
del estCapture.exe
goto:eof
:estCapture
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
public class MyClass
{
public static void Main()
{
Image img = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);
Graphics g = Graphics.FromImage(img);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.AllScreens[0].Bounds.Size);
img.Save("estCapture.jpeg", ImageFormat.Bmp);
}
} |
|