OT: Friday bee-Fuddled

Discussion in 'MCSE' started by Frisbee®, Feb 17, 2006.

  1. Frisbee®

    Frisbee® Guest

    Rather than post the question in here (because y'all are just a bunch of
    knot-heads anyway) I'll instead ask what would be the appropriate group to
    post a question about a bizarre behaviour of a batch file running under
    Windows XP? There appears to be literally hundreds of newsgroups with "xp"
    in the name (outlook express being included doesn't help in narrowing down
    the groups).

    It's a rather lengthy production batch file I've written that for some
    reason seems to work just fine if you drop to a CMD prompt and just run the
    batch file manually, but if you make a shortcut on the desktop, it gets to a
    certain point and fails, but the really bizarre thing is that it replaces
    environment variables with parts of the batch file itself. Never seen
    anything like this before in over 20 years of writing batch files.

    Oh, heck. Just for the Halibut, I'll post it here:

    @echo off
    set BNDDRV=%1
    set CDRDRV=%2
    if "%BNDDRV%"=="" set BNDDRV=G:
    if "%CDRDRV%"=="" set CDRDRV=E:
    cls
    echo Location of Bondsman Production: %BNDDRV%\Bondsman
    echo Drive letter for CD-RW: %CDRDRV%
    echo.
    echo This batch file creates a CD for the DASI Bail Bondsman
    echo.
    echo You must first prepare the CD to be writable via the
    echo Adaptec DirectCD Wizard. Do this by double-clicking
    echo the CD icon in the system tray.
    echo.
    echo If you have not already done this, this batch file will
    echo fail during its attempt to xcopy the file.
    echo.
    echo If you have not already prepared the CD, press CONTROL-C
    echo to abort this batch file, otherwise press any other key
    echo to continue...
    echo.
    pause
    cls
    echo Copying %BNDDRV%\Bondsman\Autorun.Inf to %CDRDRV%\Autorun.Inf
    echo.
    xcopy %BNDDRV%\Bondsman\Autorun.Inf %CDRDRV%\
    echo.
    if not exist %CDRDRV%\Autorun.Inf goto badxcopy
    echo Copying %BNDDRV%\Bondsman\Setup.Exe to %CDRDRV%\Setup.Exe
    echo.
    xcopy %BNDDRV%\Bondsman\Setup.Exe %CDRDRV%\
    echo.
    if not exist %CDRDRV%\Setup.Exe goto badxcopy
    echo Copying %BNDDRV%\Bondsman\The Bondsman Manual.PDF to %CDRDRV%\
    echo.
    xcopy "%BNDDRV%\Bondsman\The Bondsman Manual.PDF" %CDRDRV%\
    echo.
    if not exist "%CDRDRV%\The Bondsman Manual.PDF" goto badxcopy
    echo Copying %BNDDRV%\Bondsman\Bondsman Startup Sheet.PDF to %CDRDRV%\
    echo.
    xcopy "%BNDDRV%\Bondsman\Bondsman Startup Sheet.PDF" %CDRDRV%\
    echo.
    if not exist "%CDRDRV%\Bondsman Startup Sheet.PDF" goto badxcopy
    echo Copying %BNDDRV%\Bondsman\RP500ENU.Exe to %CDRDRV%\
    echo.
    xcopy %BNDDRV%\Bondsman\RP500ENU.Exe %CDRDRV%\
    echo.
    if not exist %CDRDRV%\RP500ENU.EXE goto badxcopy
    if not exist %BNDDRV%\Bondsman\IPD002.DAT goto skipreg
    echo Copying %BNDDRV%\Bondsman\IPD002.DAT to %CDRDRV%\IPD002.DAT
    echo.
    xcopy %BNDDRV%\Bondsman\IPD002.DAT %CDRDRV%\IPD002.DAT
    echo.
    if not exist %CDRDRV%\IPD002.DAT goto badxcopy
    del %BNDDRV%\Bondsman\IPD002.DAT
    :skipreg
    if not exist %BNDDRV%\Bondsman\CustData\*.DAT goto ok
    if not exist %CDRDRV%\CustData\nul md %CDRDRV%\CustData
    echo Copying %BNDDRV%\Bondsman\CustData\*.DAT to %CDRDRV%\CustData
    echo.
    xcopy %BNDDRV%\Bondsman\CustData\*.DAT %CDRDRV%\CustData
    echo.
    if not exist %CDRDRV%\CustData\*.DAT goto badxcopy
    del %BNDDRV%\Bondsman\CustData\*.DAT
    goto ok
    :badxcopy
    echo The file was NOT successfully transfered!
    echo.
    echo The CD may not have been prepared correctly.
    goto done
    :eek:k
    dir %CDRDRV%\
    echo.
    echo The files were successfully transfered!
    echo.
    echo Now, just press the EJECT button on the CD and select the
    echo option to organize the CD so that it can be read by other
    echo CD ROM drives.
    :done
    echo.
    pause


    What happens the first go-around is the screen shows drives G: and E: at the
    intro. It copies the first two files, and when it hits the long filenames
    (hence enclosing it in quotes) it suddenly clears the screen and shows the
    opening screen again, but this time it shows instead of G: "Manual\Bondsman"
    and instead of E: it shows "goto"

    Yeah, right... "goto"

    WFT, over.

    Again, batch file runs fine when run from a command (CMD) prompt manually,
    but does this weird thing when run from the shortcut. The shortcut does
    have G: and E: passed as parameters, even though it defaults to those drive
    letters anyway.

    PIE and BENJAMINS to whomever figgers this one out.
     
    Frisbee®, Feb 17, 2006
    #1
    1. Advertising

  2. Frisbee®

    CBIC Guest

    Re: Friday bee-Fuddled


    > PIE and BENJAMINS to whomever figgers this one out.



    You're missing a period.
    --
    aka
    Doom MCNGP #38
    Is that a burdizzo in your pocket or are you just glad to see me.
     
    CBIC, Feb 17, 2006
    #2
    1. Advertising

  3. Frisbee®

    Frisbee® Guest

    Re: Friday bee-Fuddled

    "CBIC" <> wrote in message
    news:O20uda$...
    >
    >> PIE and BENJAMINS to whomever figgers this one out.

    >
    >
    > You're missing a period.


    THIS IS NOT COBOL YOU IDOT.

    OR ARE YOU SAYING THE RABBIT DIED?
     
    Frisbee®, Feb 17, 2006
    #3
  4. Frisbee®

    CBIC Guest

    Re: Friday bee-Fuddled

    In news:%23X4g9t$,
    Frisbee® <> embarrassed himself by saying:
    > "CBIC" <> wrote in message
    > news:O20uda$...
    >>
    >>> PIE and BENJAMINS to whomever figgers this one out.

    >>
    >>
    >> You're missing a period.

    >
    > THIS IS NOT COBOL YOU IDOT.
    >
    > OR ARE YOU SAYING THE RABBIT DIED?


    LOL Ok then you're missing a %
    --
    aka
    Doom MCNGP #38
    Is that a burdizzo in your pocket or are you just glad to see me.
     
    CBIC, Feb 17, 2006
    #4
  5. Frisbee®

    Jim Guest

    Re: Friday bee-Fuddled

    Did you try removing the @echo off and the cls's to see if anything weird is
    going on?
     
    Jim, Feb 17, 2006
    #5
  6. Frisbee®

    Frisbee® Guest

    Re: Friday bee-Fuddled

    "Jim" <> wrote in message
    news:eboBP6$...
    > Did you try removing the @echo off and the cls's to see if anything weird
    > is going on?


    I didn't think to try that, no. It must be Friday.

    I usually check for an environment variable %DEBUG% and bypass echo off and
    cls in that case. Without looking at my batch file again, I must have
    missed adding that code. Gonna do that now and see if it makes the problem
    any more self-evident, thanks.
     
    Frisbee®, Feb 17, 2006
    #6
  7. Frisbee®

    Jim Guest

    Re: Friday bee-Fuddled

    i dont really know batch scripting, but my guess is that there is a problem
    with this line:
    if not exist "%CDRDRV%\The Bondsman Manual.PDF" goto badxcopy

    it is the only line with both "Manual" and "goto" on it. it looks to me
    like the script is aborting, and rerunning, using manual and goto as %1 and
    2. try echoing %0 in the beginning of the script too.
     
    Jim, Feb 17, 2006
    #7
  8. Frisbee®

    kpg Guest

    Frisbee® <> said something like

    > Never seen anything like this before in over 20
    > years of writing batch files.


    OK Fris, I'll look at it for you.

    I have seen this before in one of my batch files. Run it from the cmd
    line it works, shell to it from a program and it fails. I think I even
    asked about it in here and NO ONE CARED.

    But I care.

    kp "God, I wish I knew how to quit you! " g
     
    kpg, Feb 17, 2006
    #8
  9. Frisbee®

    Frisbee® Guest

    Re: Friday bee-Fuddled

    "Jim" <> wrote in message
    news:...
    >i dont really know batch scripting, but my guess is that there is a problem
    >with this line:
    > if not exist "%CDRDRV%\The Bondsman Manual.PDF" goto badxcopy
    >
    > it is the only line with both "Manual" and "goto" on it. it looks to me
    > like the script is aborting, and rerunning, using manual and goto as %1
    > and 2. try echoing %0 in the beginning of the script too.


    I think we have a winner. Since the batchfile itself is called Bondsman.Bat
    and the folder name also happens to be Bondsman, it is indeed processing it
    as a batch file call within the batch file itself, calling itself with
    Manual and goto as the parameters. Why didn't I see that?

    Also, why in the hell is it not processing the quotation marks when you run
    it as a batch file from a shortcut, but IS processing the quotes when you
    run it manually?

    Perhaps I need double-double quotes? Much like when you type the parameter
    in a FOR command from the command line, you have to double the percent
    signs...

    Cripes, maybe I just need to remove all the friggin' spaces from the long
    filenames.

    But then I'll have to change my program, too.

    Major PITA either way.

    Thanks for pointing me in the right direction, Jim.
     
    Frisbee®, Feb 17, 2006
    #9
  10. Frisbee®

    Jim Guest

    Re: Friday bee-Fuddled

    "Frisbee®" <> wrote in message
    news:...
    > "Jim" <> wrote in message
    > news:...
    >>i dont really know batch scripting, but my guess is that there is a
    >>problem with this line:
    >> if not exist "%CDRDRV%\The Bondsman Manual.PDF" goto badxcopy
    >>
    >> it is the only line with both "Manual" and "goto" on it. it looks to me
    >> like the script is aborting, and rerunning, using manual and goto as %1
    >> and 2. try echoing %0 in the beginning of the script too.

    >
    > I think we have a winner. Since the batchfile itself is called
    > Bondsman.Bat and the folder name also happens to be Bondsman, it is indeed
    > processing it as a batch file call within the batch file itself, calling
    > itself with Manual and goto as the parameters. Why didn't I see that?


    it's friday

    > Also, why in the hell is it not processing the quotation marks when you
    > run it as a batch file from a shortcut, but IS processing the quotes when
    > you run it manually?


    windows is weird.
    maybe you need to do %CDRDRV%\"The Bondsman Manual.PDF"? or use single
    quotes?
     
    Jim, Feb 17, 2006
    #10
  11. Frisbee®

    kpg Guest

    Nope. Works fine for me. But then the problem I had before
    worked fine on my machine too.

    My problem had to do with long file names, and after much
    debugging I just went with the short names instead. But I could
    do that because my batch file was generated by code that could
    map a long name to a short name. GetShortFileName API or some
    such. I think it's a bug, um, feature, in XP. Why it works fine
    on my machine (and most others too) I don't know. All were current
    with SPs etc.

    I don't care anymore, either.
     
    kpg, Feb 17, 2006
    #11
  12. Frisbee®

    Frisbee® Guest

    Re: Friday bee-Fuddled

    "Jim" <> wrote in message
    news:Ob3Y$...
    >
    > "Frisbee®" <> wrote in message
    > news:...
    >> "Jim" <> wrote in message
    >> news:...
    >>>i dont really know batch scripting, but my guess is that there is a
    >>>problem with this line:
    >>> if not exist "%CDRDRV%\The Bondsman Manual.PDF" goto badxcopy
    >>>
    >>> it is the only line with both "Manual" and "goto" on it. it looks to me
    >>> like the script is aborting, and rerunning, using manual and goto as %1
    >>> and 2. try echoing %0 in the beginning of the script too.

    >>
    >> I think we have a winner. Since the batchfile itself is called
    >> Bondsman.Bat and the folder name also happens to be Bondsman, it is
    >> indeed processing it as a batch file call within the batch file itself,
    >> calling itself with Manual and goto as the parameters. Why didn't I see
    >> that?

    >
    > it's friday
    >
    >> Also, why in the hell is it not processing the quotation marks when you
    >> run it as a batch file from a shortcut, but IS processing the quotes when
    >> you run it manually?

    >
    > windows is weird.
    > maybe you need to do %CDRDRV%\"The Bondsman Manual.PDF"? or use single
    > quotes?


    I tried that, same output. I also tried renaming the batch file to
    MakeBBCD.Bat, still same output (which totally baffles me). And I've just
    spend more than a half hour searching Windows XP help, and it wasn't very
    helpful.

    Looks like I might just have to throw in the towel and rename the files
    themselves.
     
    Frisbee®, Feb 17, 2006
    #12
  13. Frisbee®

    Frisbee® Guest

    "kpg" <kenatweekendcomputerdotcom> wrote in message
    news:Xns976D9AA3D6B13ipostthereforeiam@127.0.0.1...
    > Nope. Works fine for me. But then the problem I had before
    > worked fine on my machine too.
    >
    > My problem had to do with long file names, and after much
    > debugging I just went with the short names instead. But I could
    > do that because my batch file was generated by code that could
    > map a long name to a short name. GetShortFileName API or some
    > such. I think it's a bug, um, feature, in XP. Why it works fine
    > on my machine (and most others too) I don't know. All were current
    > with SPs etc.
    >
    > I don't care anymore, either.


    That might be a quicker solution... I might just try to find out the short
    file names, since it's only two files, and just hard-code them that way.
     
    Frisbee®, Feb 17, 2006
    #13
  14. Frisbee®

    CBIC Guest

    I think I
    > even asked about it in here and NO ONE CARED.
    >

    What? I'm shocked and dismayed.
    --
    aka
    Doom MCNGP #38
    Is that a burdizzo in your pocket or are you just glad to see me.
     
    CBIC, Feb 17, 2006
    #14
  15. Frisbee®

    CBIC Guest

    Re: Friday bee-Fuddled

    And I've
    > just spend more than a half hour searching Windows XP help, and it
    > wasn't very helpful.
    >


    What? I'm shocked and dismayed.
    --
    aka
    Doom MCNGP #38
    Is that a burdizzo in your pocket or are you just glad to see me.
     
    CBIC, Feb 17, 2006
    #15
  16. Frisbee®

    Frisbee® Guest

    "Frisbee®" <> wrote in message
    news:%...
    > "kpg" <kenatweekendcomputerdotcom> wrote in message
    > news:Xns976D9AA3D6B13ipostthereforeiam@127.0.0.1...
    >> Nope. Works fine for me. But then the problem I had before
    >> worked fine on my machine too.
    >>
    >> My problem had to do with long file names, and after much
    >> debugging I just went with the short names instead. But I could
    >> do that because my batch file was generated by code that could
    >> map a long name to a short name. GetShortFileName API or some
    >> such. I think it's a bug, um, feature, in XP. Why it works fine
    >> on my machine (and most others too) I don't know. All were current
    >> with SPs etc.
    >>
    >> I don't care anymore, either.

    >
    > That might be a quicker solution... I might just try to find out the short
    > file names, since it's only two files, and just hard-code them that way.


    That didn't work either. It changes the short filename to some really weird
    one, but the first FOUR letters were the same, so I even tried checking for
    [firstfour]*.pdf and it still fails... ARGH!

    Maybe it will come to me over the weekend.
     
    Frisbee®, Feb 17, 2006
    #16
  17. Frisbee®

    kpg Guest

    Frisbee® <> said something like

    > That might be a quicker solution... I might just try to find out the
    > short file names, since it's only two files, and just hard-code them
    > that way.


    Sure, but in the off chance that a file/folder exists with the same
    first 6 characters or so, your 'made up' short name will be wrong.

    I could live with those odds.

    Unless you know of a way to find out the short names for real.
     
    kpg, Feb 17, 2006
    #17
  18. Frisbee®

    kpg Guest

    Re: Friday bee-Fuddled

    Frisbee® <> said something like

    > I tried that, same output. I also tried renaming the batch file to
    > MakeBBCD.Bat, still same output (which totally baffles me).


    Well, that kinda shoots down the calling itself theory then?


    Get Gates on the phone, I want to talk to him, ...NOW!
     
    kpg, Feb 17, 2006
    #18
  19. Frisbee®

    kpg Guest

    Frisbee® <> said something like

    > That didn't work either. It changes the short filename to some really
    > weird one, but the first FOUR letters were the same, so I even tried
    > checking for [firstfour]*.pdf and it still fails... ARGH!



    It should be the first 6 non-space characters + tilde + # + '.' extension.
     
    kpg, Feb 17, 2006
    #19
  20. Frisbee®

    kpg Guest

    kpg <kenatweekendcomputerdotcom> said something like

    > It should be the first 6 non-space characters + tilde + # + '.'
    > extension.


    After further review...

    the first four copies follow that rule, then it starts to get creative
    with the names.

    oh well, my beer-clock tells me it beer-thirty.


    kp "I'm shocked and dismayed." g
     
    kpg, Feb 17, 2006
    #20
    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. Juan Pérez

    Bee Vee

    Juan Pérez, May 21, 2004, in forum: Computer Support
    Replies:
    5
    Views:
    590
    BeeVee
    May 21, 2004
  2. Mark C

    These Bee's Don't Sting.....

    Mark C, Aug 7, 2003, in forum: Digital Photography
    Replies:
    1
    Views:
    3,707
    Argon3
    Aug 8, 2003
  3. Lucas Tam

    What is your favorite Bee Gees song?

    Lucas Tam, Apr 16, 2004, in forum: Digital Photography
    Replies:
    25
    Views:
    1,057
    Scrinine
    Apr 20, 2004
  4. Annika1980

    D60: BEE-LIEVE THE HYPE !!!

    Annika1980, May 24, 2004, in forum: Digital Photography
    Replies:
    23
    Views:
    740
  5. Annika1980

    D60: BEE-LIEVE IT OR NOT !!!

    Annika1980, May 30, 2004, in forum: Digital Photography
    Replies:
    6
    Views:
    340
    Annika1980
    May 31, 2004
Loading...

Share This Page