Why not Batch files??

Discussion in 'Perl Misc' started by Chris L., Feb 17, 2006.

  1. Chris L.

    Chris L. Guest

    Dear All-
    This post is in regard to a certain article I recently read on batch
    files. I currently use the Perl system() function to call a batch files
    when I need to run other applications from my perl program:

    system ("CALL", $batch_file1");

    ....and it works great. However, the article was explaining how batch
    files were almost extinct in programming. I am wondering if this is
    accurate or not. That is, should I be utilizing something else to
    automate Windows system calls? Are batch files a thing of the past? If
    so, what should I be focusing my attention on to replace them?

    Thank you for your time and expertise.
    Chris
     
    Chris L., Feb 17, 2006
    #1
    1. Advertising

  2. Chris L.

    Guest

    "Chris L." <> wrote:
    > Dear All-
    > This post is in regard to a certain article I recently read on batch
    > files. I currently use the Perl system() function to call a batch files
    > when I need to run other applications from my perl program:
    >
    > system ("CALL", $batch_file1");
    >
    > ...and it works great.


    It doesn't even compile.

    > However, the article was explaining how batch
    > files were almost extinct in programming. I am wondering if this is
    > accurate or not. That is, should I be utilizing something else to
    > automate Windows system calls? Are batch files a thing of the past?


    For me they sure are. YMMV.

    > If
    > so, what should I be focusing my attention on to replace them?


    Hmmm. How about that silly old language called Perl? I mean, you are
    posting to a Perl group, so it does seem like you should already have an
    inkling that Perl exists, no?

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Feb 17, 2006
    #2
    1. Advertising

  3. Chris L.

    Paul Lalli Guest

    Chris L. wrote:

    > This post is in regard to a certain article I recently read on batch files.


    Then it would seem that the author of the article or the site on which
    you found the article would be an appropriate place for follow ups, no?

    > However, the article was explaining how batch
    > files were almost extinct in programming. I am wondering if this is
    > accurate or not. That is, should I be utilizing something else to
    > automate Windows system calls? Are batch files a thing of the past? If
    > so, what should I be focusing my attention on to replace them?


    I'm very confused as to what your Perl question is.

    Paul Lalli
     
    Paul Lalli, Feb 17, 2006
    #3
  4. Chris L.

    Guest

    > Are batch files a thing of the past?

    It is surely used less and less from what I can see. You can use Perl
    or 3rd party automation software. I suggest try 3rd party automation
    software. Good once are not FREE but they provide a better way to write
    and edit scripts.

    We use this program called Automation Anywhere. There are many others
    out there as well. Google search can get you that.

    ray
     
    , Feb 17, 2006
    #4
  5. Re: OT: Usefulness of Bats in Perl (Was: Why not Batch files??)

    Chris L. wrote:
    > currently use the Perl system() function to call a batch files when I need
    > to run other applications from my perl
    > was explaining how batch files were almost extinct in programming. I am
    > wondering if this is
    > accurate or not.

    Hmm I don't think this is a real Perl question, you might want to try some
    batch forum in stead. I'll reply nevertheless but flag this topic as OT for
    convenience.

    Well I'd been using batch files loads for quick hacks before I learned that
    Perl is as good as it is. Now I do all of my previous batching in Perl and
    it's been a real time saver.

    But before I got into PErl big time I did some experimentation and have
    written a tutorial about Batch files and the NT/2k/XP command extensions.
    Here it is:

    http://www.student.oulu.fi/~vtatila/batch_tutorial.html

    [Oh yes, and I'm going to write a basic Perl tutorial, as soon as I have the
    time and feel I'm proficient enough in the language.]

    Briefly put, modern batch files are still about as expressive as the late
    70s basics like tinybasic and have equivalents to let, if, print and goto.
    Plus some Windows specific stuff thrown in, such as interfacing to Win32
    console apps and some elementary file parsing constructs, but that's about
    it. Still I think the code is very ugly and doesn't support structured
    programming or proper data structures at all.

    I'm glad to hear MS is going to finally revamp their shell.

    > utilizing something else to automate Windows system calls?

    You mean calling executables or batch files, I suppose. The term systemcall
    has a very specific meaning and basically comes down to calling lowlevel OS
    (kernel) services rather than using the system command in Perl. And in
    Windows the system calls are actually abstracted behind a higher level API
    called Win32. I just view this as just another level of indirection, that is
    they can change the underlying calls as much as they see fit, as long as the
    Win32 implementation stays the same to keep legacy apps happy.

    --
    With kind regards Veli-Pekka Tätilä ()
    Accessibility, game music, synthesizers and programming:
    http://www.student.oulu.fi/~vtatila/
     
    Veli-Pekka Tätilä, Feb 18, 2006
    #5
  6. Chris L.

    Juha Laiho Guest

    "Chris L." <> said:
    > This post is in regard to a certain article I recently read on batch
    >files. I currently use the Perl system() function to call a batch files
    >when I need to run other applications from my perl program:
    >
    >system ("CALL", $batch_file1");
    >
    >...and it works great.


    Ok, questions, to hopefully clarify your situation;

    1:
    Do you write these batch files yourself, or are they written by the
    provider of the called application (supposing you're not developing
    also the other application)?

    If these batch files are provided by a third party and are intended to
    be the primary means to launch the application, then I would consider
    them as the published interface to launch that application, and thus
    would use them.

    If, however you write these batch files yourself, read on.

    2:
    Are these batch files you write intended to be called from clients
    using a multitude of technologies (f.ex. from non-perl scripts,
    directly from desktop, ...)?

    If so, they provide a valid "tehcnology-neutral interface", and
    serve their purpose.

    If, however, your perl script (or a set of your perl scripts) are
    the only clients calling these batch files, then the question becomes:

    Do these batch files do something you couldn't do within perl?
    Apparently, in the end, they launch a program. That you can do
    from within perl. The issue is, what is done before that? Would
    that be doable (with reasonable effort) within perl? If so, then
    I'd get rid of the batch file and re-write the functionality in
    perl -- one less technology to maintain.

    If there are multiple perl scripts needing this functionality, then
    it'd make sense to write it as a module (so, creating a module to
    wrap the application launch logic), and use that module from
    all the client applications.
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)
     
    Juha Laiho, Feb 18, 2006
    #6
  7. Chris L.

    l v Guest

    Chris L. wrote:
    > Dear All-
    > This post is in regard to a certain article I recently read on batch
    > files. I currently use the Perl system() function to call a batch files
    > when I need to run other applications from my perl program:
    >
    > system ("CALL", $batch_file1");
    >
    > ...and it works great. However, the article was explaining how batch
    > files were almost extinct in programming. I am wondering if this is
    > accurate or not. That is, should I be utilizing something else to
    > automate Windows system calls? Are batch files a thing of the past? If
    > so, what should I be focusing my attention on to replace them?
    >
    > Thank you for your time and expertise.
    > Chris


    Lately I use batch files less because of Perl's ease. While I could
    trick a batch file to do what I wanted (at times), Perl was a natural
    fit. I can also say the same with unix shell scripts. I found I was
    echoing things to awk more than I wanted. Why not just do the whole
    thing in Perl. However, there are times I'll use a batch file over
    Perl and vice-a-versa. For example, I have some Perl scripts which do
    several tasks to my jpeg images using ImageMagick (i.e. creating a
    standard size thumbnail.). I coded the Perl script to process one
    file, passed in as and command line argument. It's great for the times
    I need to do a few jpegs. However, if I need to process an entire
    directory of jpegs, I use a batch file which uses *dos*'s for command
    which executes the perl script i.e.
    for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    IOW, don't give up using something because of something you read off
    the web (usenet included) if you have a use for it and it is doing
    exactly what you want it to do.
     
    l v, Feb 18, 2006
    #7
  8. Chris L.

    robic0 Guest

    On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:

    >Chris L. wrote:
    >> Dear All-
    >> This post is in regard to a certain article I recently read on batch
    >> files. I currently use the Perl system() function to call a batch files
    >> when I need to run other applications from my perl program:
    >>
    >> system ("CALL", $batch_file1");
    >>
    >> ...and it works great. However, the article was explaining how batch
    >> files were almost extinct in programming. I am wondering if this is
    >> accurate or not. That is, should I be utilizing something else to
    >> automate Windows system calls? Are batch files a thing of the past? If
    >> so, what should I be focusing my attention on to replace them?
    >>
    >> Thank you for your time and expertise.
    >> Chris

    >
    >Lately I use batch files less because of Perl's ease. While I could
    >trick a batch file to do what I wanted (at times), Perl was a natural
    >fit. I can also say the same with unix shell scripts. I found I was
    >echoing things to awk more than I wanted. Why not just do the whole
    >thing in Perl. However, there are times I'll use a batch file over
    >Perl and vice-a-versa. For example, I have some Perl scripts which do
    >several tasks to my jpeg images using ImageMagick (i.e. creating a
    >standard size thumbnail.). I coded the Perl script to process one
    >file, passed in as and command line argument. It's great for the times
    >I need to do a few jpegs. However, if I need to process an entire
    >directory of jpegs, I use a batch file which uses *dos*'s for command
    >which executes the perl script i.e.
    >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >
    >IOW, don't give up using something because of something you read off
    >the web (usenet included) if you have a use for it and it is doing
    >exactly what you want it to do.


    Given this is a general Perl group, maybe you should find Unix groups with a Perl slant
    for your fuckin blow hard garbage ...
     
    robic0, Feb 18, 2006
    #8
  9. Chris L.

    Guest

    robic0 wrote:
    > On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    >

    ....

    > >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    > >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F


    ....

    > Given this is a general Perl group, maybe you should find Unix groups


    What he wrote, of course, had nothing to do with Unix.

    Sinan
     
    , Feb 18, 2006
    #9
  10. Chris L.

    robic0 Guest

    On 18 Feb 2006 14:59:12 -0800, "" <> wrote:

    >robic0 wrote:
    >> On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    >>

    >...
    >
    >> >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >> >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    >
    >...
    >
    >> Given this is a general Perl group, maybe you should find Unix groups

    >
    >What he wrote, of course, had nothing to do with Unix.
    >
    >Sinan


    Uh huh...
    for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    -robic0-
     
    robic0, Feb 18, 2006
    #10
  11. Chris L.

    Guest

    robic0 wrote:
    > On 18 Feb 2006 14:59:12 -0800, "" <> wrote:
    >
    > >robic0 wrote:
    > >> On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    > >>

    > >...
    > >
    > >> >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    > >> >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    > >
    > >...
    > >
    > >> Given this is a general Perl group, maybe you should find Unix groups

    > >
    > >What he wrote, of course, had nothing to do with Unix.
    > >
    > >Sinan

    >
    > Uh huh...
    > for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    > for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F


    Let me paraphrase ...

    What he wrote, of course, had nothing to do with Unix.

    Sinan
     
    , Feb 18, 2006
    #11
  12. Chris L.

    robic0 Guest

    On 18 Feb 2006 15:05:35 -0800, "" <> wrote:

    >
    >robic0 wrote:
    >> On 18 Feb 2006 14:59:12 -0800, "" <> wrote:
    >>
    >> >robic0 wrote:
    >> >> On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    >> >>
    >> >...
    >> >
    >> >> >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >> >> >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >> >
    >> >...
    >> >
    >> >> Given this is a general Perl group, maybe you should find Unix groups
    >> >
    >> >What he wrote, of course, had nothing to do with Unix.
    >> >
    >> >Sinan

    >>
    >> Uh huh...
    >> for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >> for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    >
    >Let me paraphrase ...
    >
    >What he wrote, of course, had nothing to do with Unix.
    >
    >Sinan


    Keep trying, its not *nix, its just not...
    for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    -robic0-
     
    robic0, Feb 18, 2006
    #12
  13. Chris L.

    Guest

    robic0 wrote:
    > On 18 Feb 2006 15:05:35 -0800, "" <> wrote:
    >
    > >
    > >robic0 wrote:
    > >> On 18 Feb 2006 14:59:12 -0800, "" <> wrote:
    > >>
    > >> >robic0 wrote:
    > >> >> On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    > >> >>
    > >> >...
    > >> >
    > >> >> >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    > >> >> >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    > >> >
    > >> >...
    > >> >
    > >> >> Given this is a general Perl group, maybe you should find Unix groups
    > >> >
    > >> >What he wrote, of course, had nothing to do with Unix.
    > >> >
    > >> >Sinan
    > >>
    > >> Uh huh...
    > >> for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    > >> for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F

    > >
    > >Let me paraphrase ...
    > >
    > >What he wrote, of course, had nothing to do with Unix.
    > >
    > >Sinan

    >
    > Keep trying, its not *nix, its just not...
    > for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    > for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >
    > -robic0-


    You know, we could keep doing this forever (after all, I am posting
    from GG, so rules apply ;-), but it has already ceased to be amusing
    for anyone with an IQ above room temperature.

    The two lines above are from a batch file. They should work with
    anything from command.com in DOS v5 to the XP cmd.exe shell.

    None of this is really relevant, of course.

    The for loop in the XP cmd.exe shell has many more options. You can
    read about them by typing

    C:\> for /?

    on the command line.

    Roger?

    Sinan
     
    , Feb 18, 2006
    #13
  14. Chris L.

    robic0 Guest

    On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:

    >Chris L. wrote:
    >> Dear All-
    >> This post is in regard to a certain article I recently read on batch
    >> files. I currently use the Perl system() function to call a batch files
    >> when I need to run other applications from my perl program:
    >>
    >> system ("CALL", $batch_file1");
    >>
    >> ...and it works great. However, the article was explaining how batch
    >> files were almost extinct in programming. I am wondering if this is
    >> accurate or not. That is, should I be utilizing something else to
    >> automate Windows system calls? Are batch files a thing of the past? If
    >> so, what should I be focusing my attention on to replace them?
    >>
    >> Thank you for your time and expertise.
    >> Chris

    >
    >Lately I use batch files less because of Perl's ease.


    Lets see here, you think Perl is better than 'batch' files.
    So how does Perl compare to batch files? I think
    Larry Wall would like to know his creation is 'just this side
    better than, er ahh, batch files'...

    -robic0-
     
    robic0, Feb 18, 2006
    #14
  15. Chris L.

    robic0 Guest

    On 18 Feb 2006 15:24:22 -0800, "" <> wrote:

    >robic0 wrote:
    >> On 18 Feb 2006 15:05:35 -0800, "" <> wrote:
    >>
    >> >
    >> >robic0 wrote:
    >> >> On 18 Feb 2006 14:59:12 -0800, "" <> wrote:
    >> >>
    >> >> >robic0 wrote:
    >> >> >> On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    >> >> >>
    >> >> >...
    >> >> >
    >> >> >> >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >> >> >> >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >> >> >
    >> >> >...
    >> >> >
    >> >> >> Given this is a general Perl group, maybe you should find Unix groups
    >> >> >
    >> >> >What he wrote, of course, had nothing to do with Unix.
    >> >> >
    >> >> >Sinan
    >> >>
    >> >> Uh huh...
    >> >> for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >> >> for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >> >
    >> >Let me paraphrase ...
    >> >
    >> >What he wrote, of course, had nothing to do with Unix.
    >> >
    >> >Sinan

    >>
    >> Keep trying, its not *nix, its just not...
    >> for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >> for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >>
    >> -robic0-

    >
    >You know, we could keep doing this forever (after all, I am posting
    >from GG, so rules apply ;-), but it has already ceased to be amusing
    >for anyone with an IQ above room temperature.
    >
    >The two lines above are from a batch file. They should work with
    >anything from command.com in DOS v5 to the XP cmd.exe shell.
    >
    >None of this is really relevant, of course.
    >
    >The for loop in the XP cmd.exe shell has many more options. You can
    >read about them by typing
    >
    >C:\> for /?
    >
    >on the command line.
    >
    >Roger?
    >
    >Sinan


    Yup, roger. I know the cmd shell. But I'm sure you don't. Its a complicated
    beast! As to the game, well maybe we get to know each other. I stand on what I
    post. I correct my mistakes (if) and timely, and I respect others who follow
    suite!

    -robic0-
     
    robic0, Feb 18, 2006
    #15
  16. Chris L.

    robic0 Guest

    On Sat, 18 Feb 2006 15:33:01 -0800, robic0 wrote:

    >On 18 Feb 2006 15:24:22 -0800, "" <> wrote:
    >
    >>robic0 wrote:
    >>> On 18 Feb 2006 15:05:35 -0800, "" <> wrote:
    >>>
    >>> >
    >>> >robic0 wrote:
    >>> >> On 18 Feb 2006 14:59:12 -0800, "" <> wrote:
    >>> >>
    >>> >> >robic0 wrote:
    >>> >> >> On 18 Feb 2006 14:49:26 -0800, "l v" <> wrote:
    >>> >> >>
    >>> >> >...
    >>> >> >
    >>> >> >> >for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >>> >> >> >for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >>> >> >
    >>> >> >...
    >>> >> >
    >>> >> >> Given this is a general Perl group, maybe you should find Unix groups
    >>> >> >
    >>> >> >What he wrote, of course, had nothing to do with Unix.
    >>> >> >
    >>> >> >Sinan
    >>> >>
    >>> >> Uh huh...
    >>> >> for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >>> >> for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >>> >
    >>> >Let me paraphrase ...
    >>> >
    >>> >What he wrote, of course, had nothing to do with Unix.
    >>> >
    >>> >Sinan
    >>>
    >>> Keep trying, its not *nix, its just not...
    >>> for %%F in (*.jpg) do d:/batch/mkThumb.bat %%F "%%~nF.thumb%%~xF"
    >>> for %%F in (*.jpg) do perl C:/Perl/source/imagemagick/addkey.pl %%F
    >>>
    >>> -robic0-

    >>
    >>You know, we could keep doing this forever (after all, I am posting
    >>from GG, so rules apply ;-), but it has already ceased to be amusing
    >>for anyone with an IQ above room temperature.
    >>
    >>The two lines above are from a batch file. They should work with
    >>anything from command.com in DOS v5 to the XP cmd.exe shell.
    >>
    >>None of this is really relevant, of course.
    >>
    >>The for loop in the XP cmd.exe shell has many more options. You can
    >>read about them by typing
    >>
    >>C:\> for /?
    >>
    >>on the command line.
    >>
    >>Roger?
    >>
    >>Sinan

    >
    >Yup, roger. I know the cmd shell. But I'm sure you don't. Its a complicated
    >beast! As to the game, well maybe we get to know each other. I stand on what I
    >post. I correct my mistakes (if) and timely, and I respect others who follow
    >suite!
    >
    >-robic0-


    Since in the far past I've had to use the NT shell (as you call it) to build
    drivers and installs. The phrasing 2 lines above is clearly meant for Unix.
    I don't know wht your, or is 'GG' means but thems the facts.
    The NT shell is one of the most complicated shells ever created. 'It' has nothing
    to do with Unix, except by the accidental, unknowing verbage overlapp...

    Let this dog lie or it will bite ya!

    -robic0-
     
    robic0, Feb 18, 2006
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    418
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    935
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,128
    Smokey Grindel
    Dec 2, 2006
  4. Chris Rebert

    Re: Converting .py files to batch files.

    Chris Rebert, Sep 15, 2008, in forum: Python
    Replies:
    0
    Views:
    388
    Chris Rebert
    Sep 15, 2008
  5. Matias Surdi

    Re: Converting .py files to batch files.

    Matias Surdi, Sep 15, 2008, in forum: Python
    Replies:
    4
    Views:
    527
Loading...

Share This Page