Open and close websites in batch

ぐ巨炮叔叔 提交于 2021-02-07 10:52:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!