How to Open and Close Internet Explorer from batch file?

Veer

I Have a batch file which has to launch Internet explorer and open www.google.com. When the whole page loads finishing it should kill the IE process i.e. close all instances of IE in that system. My batch file has following two lines.

iexplore.exe "www.google.com"
taskkill /IM iexplore.exe /F

But after loading it is not closing the IE instance.

If I am having seperate batch file with with only single line taskkill /IM iexplore.exe /F. This batch file closes the IE instance.

What is going wrong in First Batch file.

P.S Batch file is in Internet Explorer folder of program files.

Hackoo

I don't understand exactly your aim to open and to close immediately Internet explorer ? but here is an example with a sleep to show you how it does work !

@echo off
Title Start and Kill Internet Explorer
Mode con cols=75 lines=5 & color 0B
echo(
echo                     Launching Internet Explorer ...
Start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "www.google.com"
:: Sleep for 20 seconds
Timeout /T 20 /NoBreak>NUL
echo(
echo            Hit any Key to kill all instances of Internet Explorer
Pause>nul
Cls & Color 0C
echo(
echo              Killing Internet Explorer Please wait for a while ...
Taskkill /IM "iexplore.exe" /F
pause

And if you want to see more features like how to start a process and how to kill one process or multiple processes at once that interact with user input with a dynamic menu you should take a look at this post ==> How to check and correct user input when he omit the extension .exe to kill the process?

Try this alternative without confirmation from the user input :

@echo off
Title Start and Kill Internet Explorer
Mode con cols=75 lines=5 & color 0B
echo(
echo                     Launching Internet Explorer ...
Start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "www.google.com"
:: Sleep for 10 seconds, you can change the SleepTime variable
set SleepTime=10
Timeout /T %SleepTime% /NoBreak>NUL
Cls & Color 0C
echo(
echo              Killing Internet Explorer Please wait for a while ...
Taskkill /IM "iexplore.exe" /F

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Internet Explorer 11 detection from Batch File

From Dev

How to close Internet Explorer from the Run box?

From Dev

How to properly close Internet Explorer when launched from PowerShell?

From Dev

How to write a batch file to open applications and close them if they are already open

From Dev

How to open Internet Explorer for the desktop from command line in Windows 8?

From Dev

How to Open/Close An HTML Select Using JavaScript in Internet Explorer, FireFox and Chrome

From Dev

Internet explorer shows gibberish for save/open file?

From Dev

How to download the file from webapi in Internet Explorer using angular post?

From Dev

When using VBA to open a CSV file directly from internet explorer, I cant then Interact with the file.

From Dev

How to read a file from "open With" option of File Explorer?

From Dev

How to read a file from "open With" option of File Explorer?

From Dev

batch - how can I close a batch file that was started from another batch file

From Dev

Open file sleep then close infinite loop in batch?

From Dev

Open file sleep then close infinite loop in batch?

From Dev

How do I open maximized internet explorer?

From Dev

How to Open With a Batch File

From Dev

How Close task in batch file

From Dev

How to close cmd in batch file

From Java

How to downgrade from Internet Explorer 11 to Internet Explorer 10?

From Dev

How to open a terminal quickly from a file explorer at a folder in Windows 7?

From Dev

Close all Internet Explorer instances from the command line?

From Dev

Batch command : how to close an open folder?

From Dev

How can I use a batch shortcut to open multiple Windows Explorer folders, and a Notepad file?

From Dev

How to close an Internet Explorer instance inside an Excel VBA

From Dev

How to close specific file explorer in C#?

From Dev

How to close File Explorer in `selenium webdriver`

From Dev

Force open button for XML file download in Internet Explorer

From Dev

How to Open only UserForm of an excel macro from batch file

From Dev

How to open multiple tabs in IE8 from batch file?

Related Related

  1. 1

    Internet Explorer 11 detection from Batch File

  2. 2

    How to close Internet Explorer from the Run box?

  3. 3

    How to properly close Internet Explorer when launched from PowerShell?

  4. 4

    How to write a batch file to open applications and close them if they are already open

  5. 5

    How to open Internet Explorer for the desktop from command line in Windows 8?

  6. 6

    How to Open/Close An HTML Select Using JavaScript in Internet Explorer, FireFox and Chrome

  7. 7

    Internet explorer shows gibberish for save/open file?

  8. 8

    How to download the file from webapi in Internet Explorer using angular post?

  9. 9

    When using VBA to open a CSV file directly from internet explorer, I cant then Interact with the file.

  10. 10

    How to read a file from "open With" option of File Explorer?

  11. 11

    How to read a file from "open With" option of File Explorer?

  12. 12

    batch - how can I close a batch file that was started from another batch file

  13. 13

    Open file sleep then close infinite loop in batch?

  14. 14

    Open file sleep then close infinite loop in batch?

  15. 15

    How do I open maximized internet explorer?

  16. 16

    How to Open With a Batch File

  17. 17

    How Close task in batch file

  18. 18

    How to close cmd in batch file

  19. 19

    How to downgrade from Internet Explorer 11 to Internet Explorer 10?

  20. 20

    How to open a terminal quickly from a file explorer at a folder in Windows 7?

  21. 21

    Close all Internet Explorer instances from the command line?

  22. 22

    Batch command : how to close an open folder?

  23. 23

    How can I use a batch shortcut to open multiple Windows Explorer folders, and a Notepad file?

  24. 24

    How to close an Internet Explorer instance inside an Excel VBA

  25. 25

    How to close specific file explorer in C#?

  26. 26

    How to close File Explorer in `selenium webdriver`

  27. 27

    Force open button for XML file download in Internet Explorer

  28. 28

    How to Open only UserForm of an excel macro from batch file

  29. 29

    How to open multiple tabs in IE8 from batch file?

HotTag

Archive