0
>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
ashleedawg
  • 20,365
  • 9
  • 72
  • 105
codemastermind
  • 312
  • 1
  • 3
  • 19
  • Even if that did work, it wouldn't close the active tab. Have you found programs such as AutoHotKey or AutoIt? – OneCricketeer Oct 18 '17 at 05:36
  • No Its not working, command is not exists. Is there any way to close that specific tab ? – codemastermind Oct 18 '17 at 05:48
  • I said **if** it worked. Also - are you trying to use PowerShell? Or CMD? I don't use either - so I cannot tell you how, but I still don't think such a thing is possible. Since Edge does not run separate processes for each tab like Chrome – OneCricketeer Oct 18 '17 at 05:55
  • I am using CMD only. – codemastermind Oct 18 '17 at 06:57
  • Well, like I said, it's one process running all the tabs. You can only kill the browser https://superuser.com/questions/727724/close-programs-from-the-command-line-windows Otherwise, you need to simulate a CTRL+W keyboard combination while Edge has focus. And AutoHotKey is perfect for that – OneCricketeer Oct 18 '17 at 08:00

4 Answers4

1

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.

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
1

you can use the following code in cmd:

    TaskKill /im "msedge.exe" /f
0

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)
Bryan__T
  • 93
  • 8
-1

**It work for me **

taskkill /IM msedge.exe /F