CMD vs. BAT

  • Thread starter Thread starter Bassam Abdul-Baki
  • Start date Start date
B

Bassam Abdul-Baki

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
 
Sorry. The last part should have said but running it from a CMD file does
not work on all XP machines.

Bassam
 
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/[email protected]

I always use a .bat extension in XP.

Clay Calvert
(e-mail address removed)
Replace "W" with "L"
 
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.

Bassam
 
Bassam Abdul-Baki said:
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
 
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. :-)

Bassam
 
In said:
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.
 
When you said we still have no idea, did you imply that you've experienced
them too? As for myself, I've only experienced this on the customer's
domain. All Win XP Pro macgines are ghosted from the same image. It occurs
to me that this might be a group policy thing, but the network
administrators there are too busy to care about a product that a
sub-contractor's developing. :-( In answer to your questions, I haven't
check any of what you've mentioned. However, two identically ghosted images
produce different results. Most people don't even known about changing the
autorun entries, and I certainly didn't do it on my machine, where it fails.
Considering this is a standard Win XP installation image, I think the group
policies are to blame. One thing I do know that since this is a government
site, they do have secure settings setup for most users, clients and
servers. Since I'm not an administrator there and have no clout in forcing
them to check for me, I think using a BAT file may be my easy way out.

Bassam
 
In said:
When you said we still have no idea, did you imply that you've
experienced them too?

No. I am just throwing out ideas that may or may not be items that
could possibly be related. Purely speculative with no first-hand
experience with the stated problem.
As for myself, I've only experienced this
on the customer's domain. All Win XP Pro macgines are ghosted
from the same image. It occurs to me that this might be a group
policy thing, but the network administrators there are too busy to
care about a product that a sub-contractor's developing. :-( In
answer to your questions, I haven't check any of what you've
mentioned. However, two identically ghosted images produce
different results. Most people don't even known about changing
the autorun entries, and I certainly didn't do it on my machine,
where it fails. Considering this is a standard Win XP installation
image, I think the group policies are to blame. One thing I do

So they are ghosted from the same image and subject to the same
domain GP? And yet they behave differently... I'm stumped.
know that since this is a government site, they do have secure
settings setup for most users, clients and servers. Since I'm not
an administrator there and have no clout in forcing them to check
for me, I think using a BAT file may be my easy way out.

If it works... <G>
Good luck. And please post back if the cause (and cure) is ever
brought to light.
 
No, what I meant that they're ghosted from the same image, but the machines
that fail are for people with different group policies and stuff. Thus,
Group Policies are different. I just can't get the admins to give me a list
of all accounts and all policies. If I come across a solution, I'll be sure
to let everyone known. Microsoft needs to start paying us users (money,
software, or prizes) for feedback. :-)

Bassam
 
Back
Top