Computing.Net > Forums > Programming > Batch file exits after GET command

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 file exits after GET command

Reply to Message Icon

Name: carbide20
Date: September 12, 2007 at 02:09:55 Pacific
OS: XP Media Center
CPU/Ram: Pentium 4 - 2.80 Ghz, 1.2
Product: Dell Inspiron 5150
Comment:

Hello,
I am trying to write a batch file that gets an ical file from a website using GET and writes that to an ics file. I want it to do that multiple times, but my batch file exits after it does it once.

I also have a problem where if I type the EXACT same command seen below into command prompt, it outputs my ics calendar to the file created, but if its run as a batch file, it outputs an html error page.

get "http://ics website here/calendar.ics" > calendar.ics

I want more than one of those to run, and to get the contents of the ics file, not an html error page... please help!


http://www.shazink.com
Shazink Web Templates



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: September 12, 2007 at 02:30:46 Pacific
Reply:

"Get?"


0

Response Number 2
Name: Mechanix2Go
Date: September 12, 2007 at 05:37:30 Pacific
Reply:

I'm glad it's not just me.


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

M2



0

Response Number 3
Name: FishMonger
Date: September 12, 2007 at 09:05:58 Pacific

Response Number 4
Name: carbide20
Date: September 12, 2007 at 15:50:29 Pacific
Reply:

I'm talking about command prompt, not terminal. I"m on windows


0

Response Number 5
Name: Razor2.3
Date: September 12, 2007 at 17:27:45 Pacific
Reply:

Well, the general consensus around here is that we've never heard of your "GET," and we request a link to information about the program in question. Unless it IS WGET. In which case you need to make these things clear.


0

Related Posts

See More



Response Number 6
Name: FishMonger
Date: September 12, 2007 at 18:38:22 Pacific
Reply:

Well, as it turns out, it appears that it's a poor attempt by Microsoft to have their version of wget.

========================================================
C:\>get
Usage: get [-options] <url>...
-m <method> use method for the request (default is 'GET')
-f make request even if get believes method is illegal
-b <base> Use the specified URL as base
-t <timeout> Set timeout value
-i <time> Set the If-Modified-Since header on the request
-c <conttype> use this content-type for POST, PUT, CHECKIN
-a Use text mode for content I/O
-p <proxyurl> use this as a proxy
-P don't load proxy settings from environment
-H <header> send this HTTP header (you can specify several)

-u Display method and URL before any response
-U Display request headers (implies -u)
-s Display response status code
-S Display response status chain
-e Display response headers
-d Do not display content
-o <format> Process HTML content in various ways

-v Show program version
-h Print this message

-x Extra debugging output


0

Response Number 7
Name: ghostdog
Date: September 12, 2007 at 19:15:22 Pacific
Reply:

@carbide, show the whole code you have.


0

Response Number 8
Name: Mechanix2Go
Date: September 12, 2007 at 21:13:34 Pacific
Reply:

FM,

No such thing in w2000.


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

M2



0

Response Number 9
Name: carbide20
Date: September 13, 2007 at 02:57:06 Pacific
Reply:

get "webcal://ical.mac.com/ical/US32Holidays.ics" > holidays.ics
get "webcal://ical.mac.com/ical/Movies.ics" > movies.ics
get "webcal://ical.mac.com/ical/DVDs.ics" > dvds.ics


0

Response Number 10
Name: FishMonger
Date: September 13, 2007 at 18:15:21 Pacific
Reply:

After M2's comment, I decided to take a closer look into the details of the get command. I ran a search on my system for get.exe and the only thing that came up was clientget.exe, which is part of Visual C++ .Net. I then did a google search and came up with a number of references, but none of them related to retrieving web content. I did a new search on my system and found GET.bat and it turns out to be a Perl script “in disguise”. So it appears that I put a big fat foot in my mouth in my previous post. :-(

Here's the beginning of the script.
==============================================================
@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!/usr/bin/perl -w
#line 15

# $Id: lwp-request,v 2.6 2003/10/26 14:39:18 gisle Exp $
#

Then there's a bunch of POD (Plain Old Document) info (manual on the command's usage) and then the rest is Perl code.

$progname = $0;
$progname =~ s,.*[\\/],,; # use basename only
$progname =~ s/\.\w*$//; # strip extension, if any

$VERSION = sprintf("%d.%02d", q$Revision: 2.6 $ =~ /(\d+)\.(\d+)/);


require LWP;
require LWP::Debug;

use URI;
use URI::Heuristic qw(uf_uri);

use HTTP::Status qw(status_message);
use HTTP::Date qw(time2str str2time);

etc
etc
================================
I'm assuming that this is the same command that carbide20 is referring to and if that's true, then it would be more efficient to use a full Perl script instead of the batch file. Part of the problem with using multiple get commands in a batch file is that it needs to load the Perl interpretor for each call which increases overhead. There are a number of ways to retrieve the web files using a Perl script in an efficient manor; here's one possible approach.

#!C:/perl

use warnings;
use strict;
use LWP::Simple;

my %calander = (
'holidays.ics' => "http://ical.mac.com/ical/US32Holidays.ics",
'movies.ics' => "http://ical.mac.com/ical/Movies.ics",
'dvds.ics' => "http://ical.mac.com/ical/DVDs.ics",
);

foreach my $ics (keys %calander) {
getstore($calander{$ics}, $ics);
}


0

Response Number 11
Name: Razor2.3
Date: September 14, 2007 at 03:37:13 Pacific
Reply:

Well, if it's GET.BAT, then we know the problem. In his batch file, he must use CALL GET


0

Response Number 12
Name: carbide20
Date: September 14, 2007 at 14:11:30 Pacific
Reply:

oh wow... call get worked. it gets all the calendars now, but they are still saving the html of an error page rather than the ics file itself. This only happens in batch files, and not in the command prompt. in command prompt it gets the ics data just fine.


0

Response Number 13
Name: carbide20
Date: September 14, 2007 at 14:13:00 Pacific
Reply:

it's google's Feed Processing Error if that helps anyone...


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 file exits after GET command

Batch File: Get Words www.computing.net/answers/programming/batch-file-get-words/13946.html

batch file to set in schedule task www.computing.net/answers/programming/batch-file-to-set-in-schedule-task/14751.html

BATch file -- Delay after deltree www.computing.net/answers/programming/batch-file-delay-after-deltree/13889.html