Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close a single tab in Chrome using Batch command

I'm relatively new to batch commands and have been learning steadily. My problem is like this:

I've understood how to kill processes using batch commands using many different methods. However, I've been unable to figure out how to close a single tab in, preferably, chrome.

Any thoughts would be greatly appreciated! Thanks!


So, I suppose I should state my exact problem.

I'm using notepad++ as my LaTeX compiler and sending the final pdf to chrome. The reason: I usually have ~20 tabs open related to the project I'm working on and it just makes my work much easier to split my screen between notepad++ and chrome. My current batch file compiles the LaTeX code and sends the compiled document to chrome as a new tab. For obvious reasons, i don't want to close a tab each time I compile, so I thought that closing the current tab at the same time during compiling would solve my problem. But, I just can't find a way to get my batch file to only close the tab with my compiled pdf.

Thanks in advance!

like image 791
fiziks Avatar asked Sep 10 '13 23:09

fiziks


People also ask

How do I force close one tab?

You can get that tab closed by using the Task Manager. Find the tab in the list. They are listed by <title> so hopefully you either recognize it or can drag the window wide enough to see the name in the tab itself. Then click the End Process button in the lower right.


1 Answers

check all running chrome instances/tabs with :

wmic process where "caption='chrome.exe'" get

and see processes properties.Probably the best indicator that you can rely on in this case is CreationDate (other properties are basically the same for all chrome instances) - it always comes in format YYYYMMDDHHmmss.ms and is easy for string comparison.But you'll have to know the time when it was started.

like image 65
npocmaka Avatar answered Sep 19 '22 13:09

npocmaka