@echo off
@title Login
echo ^<htm^> >> "start.hta"
echo ^<head^> >> "start.hta"
echo ^<link rel="stylesheet" link="style.css"^> >> "start.hta"
echo ^</head^> >> "start.hta"
echo ^<body^> >> "start.hta"
echo ^<p^>Hello!^</p^> >> "start.hta"
echo ^</body^> >> "start.hta"
echo ^</html^> >> "start.hta"
start.hta
以上是我的代码。我想要一种计时器,我们只需在计时器结束后删除该文件即可。
通过合并一些
powershell
获取进程id,睡眠10秒并通过进程id杀死。
@echo off
@title Login
echo ^<htm^> > "start.hta"
echo ^<head^> >> "start.hta"
echo ^<link rel="stylesheet" link="style.css"^> >> "start.hta"
echo ^</head^> >> "start.hta"
echo ^<body^> >> "start.hta"
echo ^<p^>Hello!^</p^> >> "start.hta"
echo ^</body^> >> "start.hta"
echo ^</html^> >> "start.hta"
for /f %%i in ('powershell "(Start-Process start.hta -passthru).ID"') do (
timeout /t 10
taskkill /F /PID %%i
del "start.hta"
)