Jump to content

Recommended Posts

Posted

Hi,

What exactly is the difference between BAT and CMD files? As far as I can tell they're about the same.

Are they just the same with a different file extension?

Thanks

HougTimo


Posted

yes it's just the extension.

You can keep .bat to keep compatibility with old-windows (9x)

.cmd work only on NT 5.x systems (xp/2000)

Posted

BAT files work in the context of command.com.

CMD files work in the context of cmd.exe.

There are some things you can do within CMD files that take a bit more work to do in a BAT file. For instance, if I wanted to "start" a process and tell the script to wait on it to finish this would be the line to use in a CMD file:

START "" /WAIT process_to_start.exe

But to do the same thing in a BAT file you have to do the following:

%COMSPEC% /C START "" /WAIT process_to_start.exe

which effectively calls the CMD.EXE environment with the %COMSPEC% command. If you're using strictly Windows 2000 or XP then I personally would stick with just using the CMD extension.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...