How to gently close Chrome using CMD or VBS?

前端 未结 2 1106
悲&欢浪女
悲&欢浪女 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
    
    0 讨论(0)
  • 2021-01-07 07:46

    you can use powershell to close all windows with chrome as process name. It won't kill the task but gently close all chrome browser windows, like if you clicked on top-right cross. Here is the command line to put in batch :

    powershell -command "Get-Process chrome | ForEach-Object { $_.CloseMainWindow() | Out-Null}"
    
    0 讨论(0)
提交回复
热议问题