'How to close Microsoft Edge browser's current tab from command prompt?

>start microsoft-edge:http://google.com

Its opened google.com in edge browser new tab. Now I want to close. Here I am using stop but its not working.

>stop microsoft-edge:http://google.com


Solution 1:[1]

taskkill /F /IM MicrosoftEdge.exe will kill it dead, but this will also terminate any other instances as well. In my experience, this force close will re-open with all tabs that were open before being "killed" even with Edge configured to not open with previous pages. My workaround to that was to taskkill /F /IM MicrosoftEdgeCP.exe repeatedly, with a 1 second delay, until all tabs were closed (going too fast did not kill all tabs). This also killed Edge when the last tab was closed.

Example

start https://www.bing.com/search?q=a
timeout 3
start https://www.bing.com/search?q=ab
timeout 3
start https://www.bing.com/search?q=abc
timeout 3

:KillEdge
timeout 1
taskkill /F /IM MicrosoftEdgeCP.exe
if %errorlevel% NEQ 0 (goto :eof) else (goto KillEdge)

Solution 2:[2]

If, by chance, the goal is to use Edge to "ping" a website then close Edge, I may have a solution.

The Chromium command line switch --no-startup-window used along with a url in Edge seem to have the effect of closing the application after background-loading the specified page in the background. The bits of documentation I've been able to find about Chromium's command-line switchesI've been able to find for this imply that the application should stay running in the background, but that does not seem to be the case (for me anyway) when used this way.

For example, if you wanted to schedule a recurring background random Bing search, like so you could (hypothetically) auto-collect? Microsoft's Search & Earn points, you may be able to schedule an event to run a batch file every couple hours, something like:

start msedge --no-startup-window https://www.bing.com/search?q=%random%

The only way I could tell it was doing anything at all was by watching the Task Manager for Microsoft Edge to appear for a split second.

?This is just an example use case and is probably against the program's terms so don't actually use it for that.

Solution 3:[3]

**It work for me **

taskkill /IM msedge.exe /F

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 ashleedawg
Solution 3 A Niyomsuk