How to gently close Chrome using CMD or VBS?

前端 未结 2 1119
悲&欢浪女
悲&欢浪女 2021-01-07 07:07

I\'m having a little problem about closing gently Chrome in order to automatically clean cache.

I have a website that is not refreshing correctly, but it does if I cl

2条回答
  •  春和景丽
    2021-01-07 07:38

    Refer to the answer of @tuxy42 : You can write with vbscript to open chrome browser like this : Open_Chrome_Browser.vbs

    Set ws = CreateObject("Wscript.Shell")
    siteA = "https://stackoverflow.com/questions/62516355/google-chrome-always-says-google-chrome-was-not-shut-down-properly"
    ws.Run "chrome -url " & siteA
    

    And if you want to close it safely : safely_close_chrome_browser.vbs

    Set ws = CreateObject("Wscript.Shell")
    psCommand = "Cmd /C powershell -command ""Get-Process chrome | ForEach-Object { $_.CloseMainWindow() | Out-Null}"""
    ws.run psCommand,0,True
    

提交回复
热议问题