Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

I'm glad it's not just me.
=====================================
If at first you don't succeed, you're about average.M2

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.

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

FM,
No such thing in w2000.
=====================================
If at first you don't succeed, you're about average.M2

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

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);
}

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.

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

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