PC Review
Forums
Newsgroups
Windows 2000
Microsoft Windows 2000 CMD Promt
Difference between .cmd & .bat files?
Forums
Newsgroups
Windows 2000
Microsoft Windows 2000 CMD Promt
Difference between .cmd & .bat files?
![]() |
Difference between .cmd & .bat files? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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" <gmamayek@dllr.state.md.us> wrote in message news:3F183117.8F694280@dllr.state.md.us... > 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 > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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" <gmamayek@dllr.state.md.us> wrote in message > news:3F183117.8F694280@dllr.state.md.us... > > 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 |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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" <gmamayek@dllr.state.md.us> wrote in message news:3F183930.6056EC31@dllr.state.md.us... > 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" <gmamayek@dllr.state.md.us> wrote in message > > news:3F183117.8F694280@dllr.state.md.us... > > > 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 > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
"Dean Wells [MVP]" <dwells@mask.msetechnology.com> wrote in message news:#v1wLUVTDHA.2768@tk2msftngp13.phx.gbl...
> 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 |
|
|
|
#7 |
|
Guest
Posts: n/a
|
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" <gmamayek@dllr.state.md.us> wrote in message news:3F183117.8F694280@dllr.state.md.us... > 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 > > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
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" <qiournvdlirhjgiuhdiuh345@hotmail.com> wrote in message news:bf9iad$cgcjq$1@ID-156657.news.uni-berlin.de... > "Dean Wells [MVP]" <dwells@mask.msetechnology.com> wrote in message news:#v1wLUVTDHA.2768@tk2msftngp13.phx.gbl... > > 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 > > > |
|
|
|
#9 |
|
Guest
Posts: n/a
|
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]" <dwells@mask.msetechnology.com> wrote in message news:eELLM1WTDHA.2768@tk2msftngp13.phx.gbl... > 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" <qiournvdlirhjgiuhdiuh345@hotmail.com> wrote in message > news:bf9iad$cgcjq$1@ID-156657.news.uni-berlin.de... > > "Dean Wells [MVP]" <dwells@mask.msetechnology.com> wrote in message > news:#v1wLUVTDHA.2768@tk2msftngp13.phx.gbl... > > > 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 > > > > > > > > |
|
|
|
#10 |
|
Guest
Posts: n/a
|
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" <qiournvdlirhjgiuhdiuh345@hotmail.com> wrote in message news:bf9iad$cgcjq$1@ID-156657.news.uni-berlin.de... > "Dean Wells [MVP]" <dwells@mask.msetechnology.com> wrote in message news:#v1wLUVTDHA.2768@tk2msftngp13.phx.gbl... > > 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 > > > |
|
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


