Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I need a help in MS DOS batch script. Can I call an Internet session in a batch mode in DOS script? Following example explains my problem.@echo off
iexplore www.mytestphp.com^&myparam.php
rem Above command successfully opens an rem internet browser with my required rem path name But I need control to pass rem back to the batch script
type mydata.txt >mytest2.txt
goto End
:End

::== some.bat
start www.Golden-Triangle.com
type mydata.txt > mytest2.txt
:: DONE
=====================================
If at first you don't succeed, you're about average.M2

Thanks a lot that is working. One more quick question how do I kill a IE browser session from the batch script.
::== some.bat
start www.Golden-Triangle.com
type mydata.txt > mytest2.txtkill browser session for www.Golder-Traingle.com
exit
:: DONE

Further testing reveals that start command only recognize web address starting with 'www'. My intended web address does not start with 'www'. Please help!

You could make a URL:
[InternetShortcut]
URL=http://www.golden-triangle.com/
Then:start GT.URL
=====================================
If at first you don't succeed, you're about average.M2

Ive been experimenting a little bit with your request, but unfortunately it has two major drawbacks..
1. The window you want to kill has to be the active window.
2. If you run the batch from windows, it will become the active windows. If you are in console and run the script, it works for some reason (windows doesnt see it as an active window).
I dont have time to experiment with it more right now, but perhaps anyone else have time to improve the script?
::---CODE---
@echo off
SetLocal EnableDelayedExpansion
::Find PID of process which contains windowtitle "Google"Tasklist /FI "WINDOWTITLE eq Google - Microsoft Internet Explorer" /FO "CSV" >>tmp
::Filtering out PID of the process listFor /F "tokens=1-5* delims=," %%A in (tmp) Do (
set Txt=%%B
Echo !Txt:^"=!>>tmp1)
)::Getting PID to kill
set /p PID=<tmp1
::Killing process
Taskkill /PID %PID%::Delete tmp files
del tmp
del tmp1
EndLocal::---CODE---

Hi Scroom,
No tasklist or taskkill in my w2000.
LOL
=====================================
If at first you don't succeed, you're about average.M2

Hehh, sorry. Seems to be a Xp Pro tool only. But there are alternatives.
http://www.windowsnetworking.com/kbase/WindowsTips/WindowsXP/AdminTips/Utilities/TlisttasklistPUlistlistsactivetasksandprocesses.html

I suppose you want to grab some web pages to your local ?.. Though batch can be done, but i like it simpler using Python... :-)
>>> import urllib2
>>> retrieved = urllib2.urlopen("http://www.somesite.com")
>>> all = retrieved.read()
>>> open("retrieved.html","w").write(all)There is no need to open the web page using your browser or kill your browser's process.
NB:similarly can be done in Perl/Vbscript...

Hi ghostdog,
Yeah, if you just want to get a page you could use WGET or any of several scripting lamgs. No tellin' where we're going with this.
Hi Shroom,
I looked at that link but didn't see any way to get the utilities.
=====================================
If at first you don't succeed, you're about average.M2

M2:
Well, i guess it should be possible to download the NT4 resourcekit (says it works in wk2 aswell) containing those tools from microsoft?
But my script wasn't really doing the job very well anyway.
I could use taskkill "IEXPLORER" but that would just close all IE's windows, and not just the goldentriangle window.Perhaps another programming language would be the solution.

M2
you can download the [RK]commands for W2k from the Microsoft Website.
The complete [RK] isn`t free.uli

I havent tried any of the options mentioned here as the client requirement has changed. But thanks a lot for your help.

Thanks, uli
David06, let us knowe how it plays out.
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

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