Running Lynx (text browser) from Batch File?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Wolf_22
Posts: 4
Joined: 06 Jul 2011 08:45

Running Lynx (text browser) from Batch File?

#1 Post by Wolf_22 » 06 Jul 2011 08:59

I'm trying to run Lynx in a batch file and I'm able to do it given the batch file itself is in the same directory as Lynx is, however, I want to be able to run the batch file in a different directory and doing so has been problematic...

Here's the code I have in my batch file:
Code:

Code: Select all

lynx -source http://website.com/page.php


In order to run this puppy outside of the Lynx directory, do I have to create an Environment variable or a System variable on an XP machine?

Any insight into this is appreciated.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Running Lynx (text browser) from Batch File?

#2 Post by aGerman » 06 Jul 2011 12:06

There are different possipilities.
- You could call it with the full name, like:

Code: Select all

call "C:\way\to\lynx\lynx.exe" -source http://website.com/page.php


- You could temporary extend the %path% environment variable (only for the current batch file):

Code: Select all

set "path=C:\way\to\lynx;%path%"
lynx -source http://website.com/page.php


-You could permanently extend the %path% environment variable
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx?mfr=true

Regards
aGerman

Wolf_22
Posts: 4
Joined: 06 Jul 2011 08:45

Re: Running Lynx (text browser) from Batch File?

#3 Post by Wolf_22 » 06 Jul 2011 12:26

Thanks for the reply, aGerman.

The first method you suggested made Lynx throw an error of the following:
Configuration file ./lynx.cfg is not available.


The second method threw the following error:
'lynx' is not recognized as an internal or external command, operable program or batch file.


This version of Lynx that I'm using can be found here. It's the old, stable version toward the bottom.

I've also tried to change the Environment / System variables with the following values:

C:\...\directory_where_lynx_is
C:\...\directory_where_lynx_is\ (Trailing Slash)
C:\...\directory_where_lynx_is\lynx.exe


None seemed to work. Any other ideas?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Running Lynx (text browser) from Batch File?

#4 Post by aGerman » 06 Jul 2011 13:37

I downloaded lynx and voilá there is a folder "samples" with lynx.bat inside where you could find at the first sight how to do that. Also did you ever have a look at the "help" folder?

Regards
aGerman

Wolf_22
Posts: 4
Joined: 06 Jul 2011 08:45

Re: Running Lynx (text browser) from Batch File?

#5 Post by Wolf_22 » 06 Jul 2011 14:11

YOU ARE THE MAN! Thank you, thank you, THANK YOU!
:D :D :D

Post Reply