Results 1 to 4 of 4
  1. #1
    Super Moderator
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,507
    Thanks
    0
    Thanked 4 Times in 4 Posts

    BAT file refresher needed

    I have forgotten how to test for the existence of a parameter fed to a batch file. In the following BAT file line 1 is wrong: what should it be?

    @if not exist %4 goto syntax
    process %1 %2 %3 %4
    @goto end
    :syntax
    echo syntax: process parameter1 parameter2 parameter3 parameter4
    :end

    TIA!
    -John ... I float in liquid gardens
    [acronym title="Gday mate!"][/acronym] [acronym title="What up Dude?"][/acronym] UTC -7±DS

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,507
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: BAT file refresher needed

    Dang. Just remembered:

    @if n%4==n goto syntax

    so unless there is a better way ... never mind!
    -John ... I float in liquid gardens
    [acronym title="Gday mate!"][/acronym] [acronym title="What up Dude?"][/acronym] UTC -7±DS

  3. #3
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: BAT file refresher needed

    Can't help you immediately as I haven't done it myself for years!
    But - here's my <A target="_blank" HREF=http://dmoz.org/Computers/Software/Operating_Systems/x86/DOS/Programming/Languages/Batch/>link</A> to a good list of batch resources.

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,507
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: BAT file refresher needed

    Good site, it reminded me that I can also use:

    if "%4"=="" goto syntax
    -John ... I float in liquid gardens
    [acronym title="Gday mate!"][/acronym] [acronym title="What up Dude?"][/acronym] UTC -7±DS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •