PC Review


Reply
Thread Tools Rate Thread

Difference between .cmd & .bat files?

 
 
Gregory Mamayek
Guest
Posts: n/a
 
      18th Jul 2003
Gang:\>

How come some files fire using .cmd, while others use .bat?
When would you use either one?

Is it because .cmd is for execution, while .bat is used to provide a
data source (ie. like web page .htm using SQL to call data source .bat)?

--
Cordially,
Greg
A+ BS MCSE Web Developer


 
Reply With Quote
 
 
 
 
Gregory Mamayek
Guest
Posts: n/a
 
      18th Jul 2003
Gang:\>

I looked at the extensions, so I see the different properties.

Also, is debug a good way to get more information about what's going on
compared to the last result: 0x0 field in scheduled tasks?

Gregory Mamayek wrote:

> Gang:\>
>
> How come some files fire using .cmd, while others use .bat?
> When would you use either one?
>
> Is it because .cmd is for execution, while .bat is used to provide a
> data source (ie. like web page .htm using SQL to call data source .bat)?
>
> --
> Cordially,
> Greg
> A+ BS MCSE Web Developer


--
Cordially,
Greg
A+ BS MCSE Web Developer


 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      18th Jul 2003
No difference in behavior ... whatsoever ... in the context of this
newsgroup at least.

Legacy extension implying batch of commands = .BAT
Uplevel extension implying shell script = .CMD

..BAT = common to x-DOS operating systems
..CMD = used by OS/2 and introduced in Windows NT4

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Gregory Mamayek" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Gang:\>
>
> How come some files fire using .cmd, while others use .bat?
> When would you use either one?
>
> Is it because .cmd is for execution, while .bat is used to provide a
> data source (ie. like web page .htm using SQL to call data source

..bat)?
>
> --
> Cordially,
> Greg
> A+ BS MCSE Web Developer
>
>



 
Reply With Quote
 
Gregory Mamayek
Guest
Posts: n/a
 
      18th Jul 2003
Dean:

Thanx for reply.

I am running WIN2K, but I do see a difference in that the .cmd's work,
while the .bat's don't. If I understand you correctly, this may be due to
the OS, or maybe it's the commands I'm using within the batch files.

I will have to play with some more examples to examine their behavior.

The best example is Ritchie's HTML CMD tool. It didn't work when I named
the batch file with .bat, but worked when I used .cmd.

Just a newbie...LOL


"Dean Wells [MVP]" wrote:

> No difference in behavior ... whatsoever ... in the context of this
> newsgroup at least.
>
> Legacy extension implying batch of commands = .BAT
> Uplevel extension implying shell script = .CMD
>
> .BAT = common to x-DOS operating systems
> .CMD = used by OS/2 and introduced in Windows NT4
>
> Dean
>
> --
> Dean Wells [MVP / Windows platform]
> MSEtechnology
> [[ Please respond to the Newsgroup only regarding posts ]]
> R e m o v e t h e m a s k t o s e n d e m a i l
>
> "Gregory Mamayek" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Gang:\>
> >
> > How come some files fire using .cmd, while others use .bat?
> > When would you use either one?
> >
> > Is it because .cmd is for execution, while .bat is used to provide a
> > data source (ie. like web page .htm using SQL to call data source

> .bat)?
> >
> > --
> > Cordially,
> > Greg
> > A+ BS MCSE Web Developer
> >
> >


--
Cordially,
Greg
A+ BS MCSE Web Developer


 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      18th Jul 2003
I've not seen Richie's script, can you post it?

I've discovered no differences in the behavior between .BAT and .CMD
from Windows 2000 onwards.

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Gregory Mamayek" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dean:
>
> Thanx for reply.
>
> I am running WIN2K, but I do see a difference in that the .cmd's work,
> while the .bat's don't. If I understand you correctly, this may be due

to
> the OS, or maybe it's the commands I'm using within the batch files.
>
> I will have to play with some more examples to examine their behavior.
>
> The best example is Ritchie's HTML CMD tool. It didn't work when I

named
> the batch file with .bat, but worked when I used .cmd.
>
> Just a newbie...LOL
>
>
> "Dean Wells [MVP]" wrote:
>
> > No difference in behavior ... whatsoever ... in the context of this
> > newsgroup at least.
> >
> > Legacy extension implying batch of commands = .BAT
> > Uplevel extension implying shell script = .CMD
> >
> > .BAT = common to x-DOS operating systems
> > .CMD = used by OS/2 and introduced in Windows NT4
> >
> > Dean
> >
> > --
> > Dean Wells [MVP / Windows platform]
> > MSEtechnology
> > [[ Please respond to the Newsgroup only regarding posts ]]
> > R e m o v e t h e m a s k t o s e n d e m a i l
> >
> > "Gregory Mamayek" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Gang:\>
> > >
> > > How come some files fire using .cmd, while others use .bat?
> > > When would you use either one?
> > >
> > > Is it because .cmd is for execution, while .bat is used to provide

a
> > > data source (ie. like web page .htm using SQL to call data source

> > .bat)?
> > >
> > > --
> > > Cordially,
> > > Greg
> > > A+ BS MCSE Web Developer
> > >
> > >

>
> --
> Cordially,
> Greg
> A+ BS MCSE Web Developer
>
>



 
Reply With Quote
 
Ritchie
Guest
Posts: n/a
 
      18th Jul 2003
"Dean Wells [MVP]" <(E-Mail Removed)> wrote in message news:#(E-Mail Removed)...
> No difference in behavior ... whatsoever ... in the context of this
> newsgroup at least.


I don't mean to be picky, but that's not strictly true. Create two copies
of the script below, save one as a .bat, the other as a .cmd:-

@echo off&setlocal ENABLEEXTENSIONS
call :func&&echo/I'm a cmd||echo/I'm a bat
goto :EOF

:func
md;2>nul
set var=1

I think .cmd is the preferred extension for NT/2000/XP/2003 scripts.

--
Ritchie



 
Reply With Quote
 
NuT CrAcKeR
Guest
Posts: n/a
 
      18th Jul 2003
Since no one else has added this to the mix... here it goes.

..bat extetions are executed in a 16bit VDM while .cmd extentions are
executed in a 32bit VDM. This has implications for scripts that may need to
access shared memory from other processes or applications.

..... this is an addendum to what the others in the group have already said.

NuTs

"Gregory Mamayek" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Gang:\>
>
> How come some files fire using .cmd, while others use .bat?
> When would you use either one?
>
> Is it because .cmd is for execution, while .bat is used to provide a
> data source (ie. like web page .htm using SQL to call data source .bat)?
>
> --
> Cordially,
> Greg
> A+ BS MCSE Web Developer
>
>



 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      18th Jul 2003
Hi Richie,

I've tested your enclosed syntax on 2000, XP and 2003. The bahavior of
the .BAT script is is identical to that of the .CMD script on all 3
platforms ... unless I'm missing the difference you're attempting to
exhibit.

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Ritchie" <(E-Mail Removed)> wrote in message
news:bf9iad$cgcjq$(E-Mail Removed)...
> "Dean Wells [MVP]" <(E-Mail Removed)> wrote in message

news:#(E-Mail Removed)...
> > No difference in behavior ... whatsoever ... in the context of this
> > newsgroup at least.

>
> I don't mean to be picky, but that's not strictly true. Create two

copies
> of the script below, save one as a .bat, the other as a .cmd:-
>
> @echo off&setlocal ENABLEEXTENSIONS
> call :func&&echo/I'm a cmd||echo/I'm a bat
> goto :EOF
>
> :func
> md;2>nul
> set var=1
>
> I think .cmd is the preferred extension for NT/2000/XP/2003 scripts.
>
> --
> Ritchie
>
>
>



 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      18th Jul 2003
I stand corrected ... I've just this seond noticed the difference
(opening my eyes must have helped

That's an interesting behavioral difference ... I'll do some digging and
see what else turns up.

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Dean Wells [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Richie,
>
> I've tested your enclosed syntax on 2000, XP and 2003. The bahavior of
> the .BAT script is is identical to that of the .CMD script on all 3
> platforms ... unless I'm missing the difference you're attempting to
> exhibit.
>
> Dean
>
> --
> Dean Wells [MVP / Windows platform]
> MSEtechnology
> [[ Please respond to the Newsgroup only regarding posts ]]
> R e m o v e t h e m a s k t o s e n d e m a i l
>
>
> "Ritchie" <(E-Mail Removed)> wrote in message
> news:bf9iad$cgcjq$(E-Mail Removed)...
> > "Dean Wells [MVP]" <(E-Mail Removed)> wrote in message

> news:#(E-Mail Removed)...
> > > No difference in behavior ... whatsoever ... in the context of

this
> > > newsgroup at least.

> >
> > I don't mean to be picky, but that's not strictly true. Create two

> copies
> > of the script below, save one as a .bat, the other as a .cmd:-
> >
> > @echo off&setlocal ENABLEEXTENSIONS
> > call :func&&echo/I'm a cmd||echo/I'm a bat
> > goto :EOF
> >
> > :func
> > md;2>nul
> > set var=1
> >
> > I think .cmd is the preferred extension for NT/2000/XP/2003 scripts.
> >
> > --
> > Ritchie
> >
> >
> >

>
>



 
Reply With Quote
 
Dean Wells [MVP]
Guest
Posts: n/a
 
      18th Jul 2003
It appears to require 3 components (at least that I've found so far) in
order to trigger the behavioral difference -

1. Use of a call statement
2. An error of some kind
3. an environment modification

Does this concur with your own findings?

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Ritchie" <(E-Mail Removed)> wrote in message
news:bf9iad$cgcjq$(E-Mail Removed)...
> "Dean Wells [MVP]" <(E-Mail Removed)> wrote in message

news:#(E-Mail Removed)...
> > No difference in behavior ... whatsoever ... in the context of this
> > newsgroup at least.

>
> I don't mean to be picky, but that's not strictly true. Create two

copies
> of the script below, save one as a .bat, the other as a .cmd:-
>
> @echo off&setlocal ENABLEEXTENSIONS
> call :func&&echo/I'm a cmd||echo/I'm a bat
> goto :EOF
>
> :func
> md;2>nul
> set var=1
>
> I think .cmd is the preferred extension for NT/2000/XP/2003 scripts.
>
> --
> Ritchie
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference - between - BIN & ISO - files Hunibal Windows XP General 2 1st Sep 2006 01:47 AM
what is the difference between .ost and .pst files? =?Utf-8?B?UGFwYQ==?= Microsoft Outlook Discussion 2 23rd May 2006 04:38 PM
Difference between 2 files =?Utf-8?B?QmVu?= Microsoft C# .NET 4 10th Apr 2006 03:46 PM
Difference between pocket pc cab files and Ce cab files =?Utf-8?B?RnJlZGR5Ym95?= Microsoft Dot NET Compact Framework 2 7th Nov 2005 04:06 PM
Difference between .iso and .exe files hash Windows XP General 5 23rd Nov 2003 12:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:27 AM.