Computing.Net > Forums > Programming > MS Dos batch Script Help

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.

MS Dos batch Script Help

Reply to Message Icon

Name: David06
Date: July 30, 2006 at 16:33:48 Pacific
OS: Windows 2000
CPU/Ram: 512 mb
Product: Toshiba Tecra
Comment:

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




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 30, 2006 at 20:23:58 Pacific
Reply:

::== 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



0

Response Number 2
Name: David06
Date: July 30, 2006 at 21:06:18 Pacific
Reply:

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.txt

kill browser session for www.Golder-Traingle.com

exit
:: DONE



0

Response Number 3
Name: Mechanix2Go
Date: July 30, 2006 at 21:21:35 Pacific
Reply:

No idea.


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 4
Name: David06
Date: July 31, 2006 at 00:18:20 Pacific
Reply:

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


0

Response Number 5
Name: Mechanix2Go
Date: July 31, 2006 at 00:36:36 Pacific
Reply:

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



0

Related Posts

See More



Response Number 6
Name: Shr0Om
Date: July 31, 2006 at 00:50:58 Pacific
Reply:

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 list

For /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---


0

Response Number 7
Name: Mechanix2Go
Date: July 31, 2006 at 01:02:05 Pacific
Reply:

Hi Scroom,

No tasklist or taskkill in my w2000.

LOL


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 8
Name: Shr0Om
Date: July 31, 2006 at 01:55:30 Pacific
Reply:

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


0

Response Number 9
Name: ghostdog
Date: July 31, 2006 at 03:07:07 Pacific
Reply:

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...



0

Response Number 10
Name: Mechanix2Go
Date: July 31, 2006 at 03:48:47 Pacific
Reply:

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



0

Response Number 11
Name: Shr0Om
Date: July 31, 2006 at 04:12:32 Pacific
Reply:

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.


0

Response Number 12
Name: ghostdog
Date: July 31, 2006 at 04:57:48 Pacific
Reply:

There are also pslist, pskill from sysinternals which can be used to list/kill processes.


0

Response Number 13
Name: uli_glueck
Date: July 31, 2006 at 05:38:34 Pacific
Reply:

M2

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

uli


0

Response Number 14
Name: David06
Date: August 2, 2006 at 18:07:12 Pacific
Reply:

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


0

Response Number 15
Name: Mechanix2Go
Date: August 2, 2006 at 23:29:54 Pacific
Reply:

Thanks, uli

David06, let us knowe how it plays out.


=====================================
If at first you don't succeed, you're about average.

M2



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: MS Dos batch Script Help

Simple Batch Script help www.computing.net/answers/programming/simple-batch-script-help/12744.html

Write the following MS-DOS batch fi www.computing.net/answers/programming/write-the-following-msdos-batch-fi/18277.html

Batch Script Help Needed www.computing.net/answers/programming/batch-script-help-needed/14475.html