1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Something that does not seem possible...

Discussion in 'Support' started by mathewsdw@sbcglobal.net, Apr 6, 2009.

  1. Here is a short sequence of code (unchanged!) that is in a much-larger .bat file:

    @Echo On
    Set Version=V%@ExecStr[GetVersionString]
    Iff %_EXECSTR != 0 Then
    @EchoErr Error getting version string!
    Quit 16
    Set NameFile=%@UnQuote[%Prefix]%@Left[11,%Version]%@UnQuote [%Extension]
    @Echo ======= NameFile: %NameFile
    Set N*

    Here is the output from the above code sequence:

    Set Version=V2009-04-06-16-10-07
    Iff %_EXECSTR != 0 Then
    Set NameFile=ABC.V2009-04-06.DEF
    ======= NameFile: ""
    Set N*

    The problem is that "NameFile" has either no value (or the value "", I haven't really looked into which...) immediately after the above code in the batch file. However, if I extract the above code into a new, separate, batch file, the output is as expected. I have been fooling with this for literally hours with absolutely no positive results! What is going on/what am I doing wrong/what am I missing/how can I fix it??? Please help me???

    P. S. Note that there are no quotes in the line "@Echo ======= NameFile: %NameFile" or in the variable as-listed in the "Set N*" command, but that there are quotes in the displayed output!

    P. P. S. Since this code works as expected when extracted into new, separate batch file, you probably can't test it yourself without having access to the much-larger containing batch file..) (I will post/e-mail that if anyone is interested...)

    P. P. P. S. This code is at the "heart" of the much-larger batch file (that I feel I really need which is why I am writing it...), so it is absolutely imperative that it work correctly!
  2. samintz

    samintz Scott Mintz

    May 20, 2008
    Likes Received:
    The only thing I can think of is make sure there are no foreign characters
    in your batch file. Sometimes extra nulls or 0x255's seem to show up for
    odd reasons.

    Have you tried deleting the troublesome lines and re-typing them?

    Have you tried putting that snippet of code in its own batch script and
    CALLing it from your main script?

    You can make it a subroutine also and call it in an external file using
    the GOSUB "filename" label syntax.


    "mathewsdw@sbcglobal.net" <> wrote on 04/06/2009
    06:12:02 PM:

  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    May 20, 2008
    Likes Received:
    Have you tried running the full (problematic) batch in the debugger, with a breakpoint at the start of the misbehaving section?

Share This Page