Computing.Net > Forums > Programming > batch files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch files

Reply to Message Icon

Name: ruffmeister
Date: February 22, 2006 at 06:12:02 Pacific
OS: xp
CPU/Ram: amd 1333 512ram
Comment:

i wish to create a batch file, which will then be sent to others.
the overall plan is

launch batch file
launch ie
go to web page
wait 10
close ie
luanch ie
go to webpage
wait 10
close ie
batch ends



Sponsored Link
Ads by Google

Response Number 1
Name: Grusomhat
Date: February 22, 2006 at 20:53:15 Pacific
Reply:

Not sure how to close proccesses in command not sure if it's even possible. So here is what you want done in two files the first a .bat and the second a .vbs .

.bat file
------
@echo off
cls
start www.google.com
ping -n 1 -w 5000 1.1>nul
start close.vbs
start www.google.com
ping -n 1 -w 5000 1.1>nul
start close.vbs
-----
.vbs file call this close.vbs
----
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'iexplore.exe'")

For Each objProcess in colProcessList
objProcess.Terminate()
Next
--------------

Make sure these are both on the same folder. Also this will not work if there default browser is anything other than ie.


Grusomhat


0

Response Number 2
Name: ruffmeister
Date: February 23, 2006 at 06:14:39 Pacific
Reply:

i've seen the taskkill command this works on some machines but not others, but the task kill command could be used


0

Response Number 3
Name: Grusomhat
Date: February 23, 2006 at 10:53:39 Pacific
Reply:

Ok just a simple bat file this time. I had never heard of task kill but thankyou for pointing it out.
--------------------------
@echo off
cls
start www.google.com
ping -n 1 -w 5000 1.1>nul
taskill /pid iexplore.exe
start www.google.com
ping -n 1 -w 5000 1.1>nul
taskkill /pid iexplore


Try that.
Grusomhat


0

Response Number 4
Name: Grusomhat
Date: February 23, 2006 at 21:18:53 Pacific
Reply:

Ok there was a spelling mistake in my last post here it is without the error. This will still however only work if the default browser is ie.

start www.google.com
ping -n 1 -w 10000 1.1>nul
taskkill /pid iexplore.exe
start www.google.com
ping -n 1 -w 10000 1.1>nul
taskkill /pid iexplore.exe

if you wanted it to work with firefox i guess you could have this
--------------------------
start www.google.com
ping -n 1 -w 10000 1.1>nul
taskkill /pid iexplore.exe
taskkill /pid firefox.exe
start www.google.com
ping -n 1 -w 10000 1.1>nul
taskkill /pid iexplore
taskkill /pid firefox.exe
---------------------------

Grusomhat


0

Response Number 5
Name: ruffmeister
Date: February 24, 2006 at 06:07:06 Pacific
Reply:

the one with vb code works great, cheers taskkill isnt installed by default on all machines so i'll go with the vb one, cheers


0

Related Posts

See More



Response Number 6
Name: Grusomhat
Date: February 24, 2006 at 09:13:36 Pacific
Reply:

Awesome glad i could help.

Grusomhat


0

Response Number 7
Name: Grusomhat
Date: February 25, 2006 at 18:08:35 Pacific
Reply:

If you wanted it to to only ever open in ie heres a different bat file.

---
start iexplore.exe www.google.com
ping -n 1 -w 10000 1.1>nul
start close.vbs
start iexplore.exe www.google.com
ping -n 1 -w 10000 1.1>nul
start close.vbs
----

Hope this helps

Grusomhat


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch files

Batch file to count a specific character in a www.computing.net/answers/programming/batch-file-to-count-a-specific-character-in-a/19751.html

FTP batch file www.computing.net/answers/programming/ftp-batch-file/9027.html

batch file www.computing.net/answers/programming/batch-file/13936.html