Batch Files (.bat)

M

Mark W

Hello:

I recently have a minor problem with batch files (.bat). When I'm using My
Computer or Windows Explorer and navigate to a folder that contains a .bat
file, when I double-click on it to launch the file, I get the message
"Windows cannot open this file" and I'm asked for the program which created.

I thought this was simply a file association problem. But when I view the
file extension associations, .bat is not listed. I know I can add this, but
then what are the properties (or program) associated with the .bat file?

Any assistance on this will be appreciated. Thank you.
 
R

R. C. White

Hi, Mark.

Batch files originated a couple of decades ago in MS-DOS (or maybe even
further back). Nowadays, they run in the "DOS" emulator window, also known
as Command Prompt. Batch files are plain text files which issue a series of
DOS statements or commands. The most famous is Autoexec.bat, which ran
every time we booted up MS-DOS or Win3x/9x/ME. Batch files can be very
simple, or they can run several pages of very sophisticated programming
steps.

Bottom line, though, is that they don't get executed from the GUI. Or from
any Windows program. But you can click Start | Run and type the name of the
file (with or without the .bat extension, but you may need to provide the
path to the file) to have it executed by Command Prompt.

I haven't used batch files in years, so there are probably several things
I'm overlooking here. Maybe a current batch-file guru can update us both.
;^}

RC
 
T

Torgeir Bakken (MVP)

Mark said:
I recently have a minor problem with batch files (.bat). When I'm using My
Computer or Windows Explorer and navigate to a folder that contains a .bat
file, when I double-click on it to launch the file, I get the message
"Windows cannot open this file" and I'm asked for the program which created.

I thought this was simply a file association problem. But when I view the
file extension associations, .bat is not listed. I know I can add this, but
then what are the properties (or program) associated with the .bat file?

Any assistance on this will be appreciated. Thank you.

Hi

In the registry, verify that these two values are in place:

HKEY_CLASSES_ROOT\.bat
Default value data: batfile


HKEY_CLASSES_ROOT\batfile\shell\open\command
Default value data: "%1" %*
 
T

Torgeir Bakken (MVP)

R. C. White said:
Batch files originated a couple of decades ago in MS-DOS (or maybe even
further back). Nowadays, they run in the "DOS" emulator window, also known
as Command Prompt. Batch files are plain text files which issue a series of
DOS statements or commands. The most famous is Autoexec.bat, which ran
every time we booted up MS-DOS or Win3x/9x/ME. Batch files can be very
simple, or they can run several pages of very sophisticated programming
steps.

Bottom line, though, is that they don't get executed from the GUI.

But you can launch them from Explorer (e.g. by double clicking on them)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top