Go Back   Velocity Reviews > Newsgroups > MCSE
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

MCSE - OT: Friday bee-Fuddled

 
Thread Tools Search this Thread
Old 02-17-2006, 06:58 PM   #1
Default OT: Friday bee-Fuddled


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
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®
  Reply With Quote
Old 02-17-2006, 07:16 PM   #2
CBIC
 
Posts: n/a
Default 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
  Reply With Quote
Old 02-17-2006, 07:51 PM   #3
Frisbee®
 
Posts: n/a
Default 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®
  Reply With Quote
Old 02-17-2006, 07:58 PM   #4
CBIC
 
Posts: n/a
Default 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
  Reply With Quote
Old 02-17-2006, 08:13 PM   #5
Jim
 
Posts: n/a
Default Re: Friday bee-Fuddled
Did you try removing the @echo off and the cls's to see if anything weird is
going on?




Jim
  Reply With Quote
Old 02-17-2006, 08:23 PM   #6
Frisbee®
 
Posts: n/a
Default 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®
  Reply With Quote
Old 02-17-2006, 08:26 PM   #7
Jim
 
Posts: n/a
Default 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
  Reply With Quote
Old 02-17-2006, 08:27 PM   #8
kpg
 
Posts: n/a
Default Re: OT: Friday bee-Fuddled
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
  Reply With Quote
Old 02-17-2006, 08:49 PM   #9
Frisbee®
 
Posts: n/a
Default 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®
  Reply With Quote
Old 02-17-2006, 09:06 PM   #10
Jim
 
Posts: n/a
Default 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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DVD Verdict reviews: FRIDAY NIGHT LIGHTS, ANDY GOLDSWORTHY: RIVERS AND TIDES, and more! DVD Verdict DVD Video 0 02-01-2005 10:16 AM
Question - 'Black Friday' shopping experiences? Fire3Sky DVD Video 1 11-24-2004 03:40 AM
DVD Verdict reviews: THE HUNTING OF THE PRESIDENT, FRIDAY THE 13TH: FROM CRYSTAL LAKE TO MANHATTAN, and more! DVD Verdict DVD Video 0 10-18-2004 10:10 AM
DVD Verdict reviews: FREAKY FRIDAY (2003), STAR TREK: DEEP SPACE NINE, SEASON SEVEN, and more! DVD Verdict DVD Video 0 01-13-2004 10:05 AM
Re: NEED:They Live and Friday the 13th SE!! Ratmaster2000 DVD Video 0 07-03-2003 09:39 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46