问题
I'm trying to make an batch file that opens a website for 5 seconds, then closes it an then loop the batch, I got not much Succes, does anyone now how to do this, without letting all te cmd pages on screen(so the batch also closes the cmd after running) I hope someone can help me.
this is the code i got so far, it works but it doesnt close the cmd.exe (Web is the name of the .bat file)
@echo off
start "chrome.exe" "http://www.websitehere. co"
timeout /t 3
taskkill /IM chrome.exe /F
:loop
start /wait Web
goto loop
Greetz Bas
回答1:
I've tried this code, hope it's good for you:
What i've done is do a while loop, for you to choose how many times will the loop run.
I set the timeout as 10 seconds but you can change it for 5 seconds.
@echo off
set /A x=0
:while
if %x% LEQ 2 (
echo %x%
start /max chrome.exe https://www.google.es
timeout 10
taskkill /F /IM chrome.exe > null
set /A x=%x%+1
goto :while
)
来源:https://stackoverflow.com/questions/41331970/open-and-close-websites-in-batch