Re: CMD vs. BAT

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Mark V (notvalid_at_nul.invalid)
Date: 10/18/04

  • Next message: name: "Re: Apply "alt-D" from withhin a DOS script"
    Date: Sun, 17 Oct 2004 18:41:16 -0700
    
    

    In microsoft.public.win2000.cmdprompt.admin Bassam Abdul-Baki wrote:

    > Bassam
    >
    > "Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> wrote in
    > message news:%23z6QQUItEHA.2804@TK2MSFTNGP14.phx.gbl...
    >>
    >> "Bassam Abdul-Baki" <babdulbaki@comcast.net> wrote in message
    >> news:ulf$9axsEHA.1468@TK2MSFTNGP12.phx.gbl...
    >>> Hi Clay,
    >>>
    >>> Interesting find and read that link. Suffice to say, I will
    >>> have to use
    >> BAT
    >>> files from now on. I've always used BAT files myself in the
    >>> past, but I inherited the CMD script from the previous developer
    >>> and didn't have any problems before to warrant renaming it,
    >>> until recently. BAT files seem
    >> more
    >>> honorable than CMD, even though the link you gave seemed to
    >>> imply BAT
    >> files
    >>> are legacy OS's and CMD files are for the newer ones. The
    >>> differences between the two were clear, but irrelevant to my
    >>> case, because even the
    >> ECHO
    >>> command had garbage prepended to it (for a very tiny percentage
    >>> of
    >> machines)
    >>> and I can't figure out why. Thanks for your feedback.
    >>
    >> Contrariwise, I always use .CMD when writing batch files that use
    >> NT-specific features, whether NT, 2K, or XP. This prevents me
    >> from inadvertently running them from a Windows 98 system and
    >> either getting error
    >> messages, or remembering to code the thing to exit gracefully
    >> when run from
    >> 9X.
    >>
    >> /Al
    >>
    >>> Bassam
    >>>
    >>> "Clay Calvert" <ccalvert@Wanguru.com> wrote in message
    >>> news:4fdum09t1banu98ugi9ofnad3r10es4nip@4ax.com...
    >>> > On Thu, 14 Oct 2004 20:40:34 -0400, "Bassam Abdul-Baki"
    >>> > <babdulbaki@comcast.net> wrote:
    >>> >
    >>> >>Greetings,
    >>> >>
    >>> >>Can anyone tell me the difference between CMD files and BAT
    >>> >>files on a Windows 2003 Server domain? Basically, the BAT
    >>> >>file runs correctly on
    >> all
    >>> >>client machines whether the BAT files are located on the
    >>> >>network or locally.
    >>> >>As for the CMD files, on a few machines (XP) the files do not
    >>> >>run correctly.
    >>> >>For example, if I call "del test.txt" from a CMD file, the del
    >>> >>command gets
    >>> >>prepended with garbage and I get the following error: !@#%del
    >>> >>is not recognized as an internal or external command, operable
    >>> >>program or batch
    >>> >>file. The same call works if it is typed inside a DOS window
    >>> >>manually, but
    >>> >>running it from a BAT file does not work on all XP machines.
    >>> >>Any suggestions? Thanks.
    >>> >>
    >>> >>Bassam
    >>> >
    >>> > This post is the only place I've ever seen a documented
    >>> > difference between .bat and .cmd.
    >>> >
    >>> >
    >> http://groups.google.com/groups?selm=ODYdDP6TDHA.1552%40TK2MSFTNGP
    >> 12.phx.gbl
    >>> >
    >>> > I always use a .bat extension in XP.

    > I was using CMD files, but like my original post said, CMD files
    > were giving me problems on XP Pro machines where the BAT files
    > were working. Use whatever works I guess. :-)
    >

    And we still apparently have no idea why those systems print or
    include "garbage" when the extension is .CMD instead of .BAT. I have
    no certain knowledge why that would occur, but to get back on track.
     Have you confirmed/replaced CMD.EXE
     Have you acertained that ".bat", ".cmd", "batfile" and "cmdfile"
    association are correct and standard.
     Eliminated any "AutoRun" entries for Command Processor in the
    registry.
     Double-checked Language, Encoding, codepage, et al.
     
    Just a few to consider...

    BTW I started using the .CMD extension with early OS/2. Since both
    that and NTx Windows use cmd.exe for the console natively, it seemed
    quite natural to continue using .CMD and leaving .BAT to it's DOS
    heritage.
     


  • Next message: name: "Re: Apply "alt-D" from withhin a DOS script"

    Relevant Pages

    • Re: What is the difference between CMD and BAT file ?
      ... I have two .cmd files that are part of XP. ... my understanding is that BAT can be applied to both NT ... NOT be listed under non NT i.e. Windows 9x, Me, etc. ... typed in a Command Prompt or the Run command. ...
      (microsoft.public.windowsxp.general)
    • Re: What is the difference between CMD and BAT file ?
      ... BAT will not cause error message for commands like ... NOT be listed under non NT i.e. Windows 9x, Me, etc. ... typed in a Command Prompt or the Run command. ... File Extension .cmd ...
      (microsoft.public.windowsxp.general)
    • Re: Issue in execution of batch files Windows XP Pro
      ... Simply correcting the extension will cause desired behaviour. ... Both .cmd and .bat are "correct" extensions for a batch file and they are treated almost identically by Windows. ...
      (microsoft.public.windowsxp.general)
    • Re: Issue in execution of batch files Windows XP Pro
      ... Simply correcting the extension ... identically by Windows. ... I personally stick with CMD for NT operating systems, ... use BAT on the 98 boxes. ...
      (microsoft.public.windowsxp.general)
    • Re: YASID: Simak Story Of Thinking Appliances
      ... Unfortunatly, he's not the sort to react one way or the other, so ... I belive the final line has him facing an assembly of machines, ... By degrees he learns those are not mice, ... At the end of it he's ready with a bat to do battle ...
      (rec.arts.sf.written)