Making bat files execute again

R

Rhino

I've managed to mangle my file associations somehow, I'm not sure how.

In any case, when I click on a batch file - a file with a .bat extension -
the default behaviour is to edit the file, not to run it. When I right-click
on the file, I get option so Edit, Print, Copy, etc. but not to run.

What do I have to do to be able to have an execute option again for .bat
files, ideally as the default behaviour?
 
C

Carey Frisch [MVP]

Can't open EXE files
http://support.microsoft.com/default.aspx?scid=kb;en-us;555067&Product=winxp

Windows XP File Association Fixes
http://www.dougknox.com/xp/file_assoc.htm

[Courtesy of MS-MVP Doug Knox]

--
Carey Frisch
Microsoft MVP
Windows - Shell/User
Microsoft Community Newsgroups
news://msnews.microsoft.com/

---------------------------------------------------------------------------­----------------

:

| I've managed to mangle my file associations somehow, I'm not sure how.
|
| In any case, when I click on a batch file - a file with a .bat extension -
| the default behaviour is to edit the file, not to run it. When I right-click
| on the file, I get option so Edit, Print, Copy, etc. but not to run.
|
| What do I have to do to be able to have an execute option again for .bat
| files, ideally as the default behaviour?
|
| --
| Rhino
 
N

null

Rhino said:
I've managed to mangle my file associations somehow, I'm not sure how.

In any case, when I click on a batch file - a file with a .bat
extension - the default behaviour is to edit the file, not to run it.
When I right-click on the file, I get option so Edit, Print, Copy,
etc. but not to run.
What do I have to do to be able to have an execute option again for
.bat files, ideally as the default behaviour?

You might try creating a restore point (to backup the registry), then
opening Regedit, and finding this key:

HKEY_CLASSES_ROOT\.bat

And checking that the (Default) value is set to this:

batfile

Under this key:

HKEY_CLASSES_ROOT\batfile\shell

The (Default) value should be:

open

While this key:

HKEY_CLASSES_ROOT\batfile\shell\open\command

Should have a (Default) of:

"%1" %*
 
G

Guest

OK. I'll b(y)te. This is some kind of joke, right? Must have stepped on
someone's
dongle (or worse). 'Rhino' rhymes with 'whiner' (almost) and probably, as
usual,
also, I was a bit to longwinded again. Actually, I try to elaborate as much
as
possible at one go in a post, to avoid to much back and forth, as that takes
up
even more of your time.

So if this is some kind of coincidence, let me be the first to apologize;
but it
does look kind of suspicious in that it appears that someone, possibly the
first
respondent or maybe some MS moderator (the kinder term), thought the question
was poignant but decided to teach me a lesson in manners and brevity by re-
submitting it here in a much shorter and more complementary form via Mssr
(alias) 'Rhino'. Am I right or am I right?

In any case, fact is, as we probably all know (unless I'm really far off base
here), I clicked on my email notification to come here, which I did but,
alas,
there was no response to my post, "System Restore lies...?", anywhere in
sight.
It took a few minutes to browse and open the copasetic responses here, which
look
like exactly what I need - except for the answers to the even more pertinant
for
me supplemental queries.

(The query from 'Rhino' just seemed such a succinct, curt, well put and
wholly to the point version of my own - and with just the right touch of
grammar deviation -that it made me suspect a ghost writer. Sorry if I'm
wrong. No offense meant).

In any case, I must thank all for your time and effort. It looks like your
input
hit the nail right on the head (hopefully for 'Rhino' as well).

No need to peruse the following if time is limited or MVP's here are not into
batchfiles and such, which might be beneath some; but, to illustrate my
point, I feel obliged, for the record, to include the following toned-down
extract from my original post, thank you.

-----------------------------------------------------------------
28-Apr-06

Win XP PRO SP2 / INTEL CELERON 2.66 GHz / 224MB RAM

System Restore (expletive deleted) - just like ERUNT says.
- - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - -

This popular refrain came true for yours truly recently as well. Fortunately
System Restore does still have its good points.

All I wanted was to fix my batchfile problem. Somewhere in there I tried to
check my so-called 'file associations' to get the default 'Edit'or (Notepad)
altered to the much more sensible and presentable 'EDIT.COM' editor on the
right-click menu.

But the process there was so contorted, (muck deleted...) that I must have
accidentally changed the default 'Open' to EDIT.COM, instead of the default
'Edit'
to 'EDIT.COM'.

For the record, I couldn't find the "BAT" extension anywhere in the list,
neither before nor after I clicked 'new' (superfluous stuff deleted), etc.
(Regardless of the reasons, that extension should be there anyway).

(Frustrations deleted...)

Since then it's been an unending battle trying to get ANY of my batchfiles
to RUN (much less, run properly) - which is a heck of a hassle in any case,
in XP (here I was hoping for some helpful advice on use of batchfile in XP
from someone experienced in this ancient endeavor - not from any KB).

(excess deleted...)

(historical info deleted...)

Finally I decided to risk the dreaded System Restore and found, to my dismay,
that all the assurances given by the dialog boxes about "not affecting any
of your data" and so on and so forth, were ALL complete (expletive
abbreviation
deleted...). I'm wondering now, what "other" files of mine it "restored"...
(some
known issues would be helpful here).

I spent the last 10 days working on that batchfile which was to simplify
and largely automate the running of the MS OFFRHD tool from the command line,
(plus a few extra neat little features) so that multiple folders and multiple
Office files could be cleaned at once, in one session, by a single click on
the batchfile (with Menu).

Came to find out that 'Restore' did exactly that. Not only did it 'restore'
the batchfile AND it's support (... .txt) files in root to earlier mucked up
versions, but it did so also for several backups of them (derogatories
deleted) in
3 different folders - including 2 sub-folders! Fortunately I also had them on
diskette - but not quite the latest.

I had to finally un-do Restore, copy my final versions there to diskette
and then Restore again to the day before and replace the old files there
with my latest ones, manually.

(painful-to-certain-people remarks deleted...)

The saving grace was that Restore did restore the default 'file association'
settings to what they were before the fiasco. So at least all my batches can
run
now. (I won't go so far as to say 'run OK' because I'm still trying to
decipher
the Help language for the 'SET' cmnd, which looks totally beyond me and I'm
still
wondering whether it's Greek or old Latin).

There's supposed to be a way, also, to simulate "command/y/c" - which is gone
now from the lexicon - via 'SET', but Im still totally unclear on the
concept and
would greatly appreciate some clarification on this.

But I'm still as confused as ever over the process of selecting the correct
program to 'Open' (there's another one for you) / run / execute files w/ the
'BAT' extension. I could use a bit of enlightenment there from anyone who's
clearer on the concept than yours truly.

Babylon, here I come (if you think the latter word is any better).

Ted the Frustrated ...

------------------------------------------
 
N

null

What the hell are you talking about? Look, I was just trying to help by
pointing out the few registry keys and values that make up the
association for batch files. Nothing more.
 
G

Guest

OK. I'm back. Checked all that from both Carey and null. Right on target. AOK.

Preciate,
 
G

Guest

OK. Roger that. And thanx for those keys. I checked all those and they're OK
now after the Restore. At least now I know what to check next time.

Didn't mean to upset. Replied to both posts here. I'd thought someone had
somehow censored my post to this forum and for some reason re-submitted it in
a shorter and more presentable form when I found this thread here on
basically exact same subject and same date and time frame.

Just like now, I clicked on my email notification which brought me right
here to your message; but that wasn't the case with the 1st notification I
got. In that case when I clicked on it, I jumped into this forum OK - but
couldn't find either my query or any
answer to it. First time that happened. Just seemed very odd. Just now I did
another search and, again, found nothing.

How can it be that I got a notification (which meant someone must have read
my post and replied to it) and then I can't even find my own post here, much
less an answer to it? Then I find a 2nd thread, this one, with a query from
'Rhino' (whoever he/she might be), which is basically a neat encapsulation of
exactly what I had asked for - on same day and at around same time. Too
weird. Just didn't sound like coincidence to me. That's all I was trying to
say. Nothing more.

Now I'm wondering who it was that actually answered my post because apparently
that answer got trashed as well.

There are 2 reasons I replied to your posting first:

(1) I happened to check it first and the precise answer I was looking for
myself was right there in front of me, easy to check immediately (which I
did) and

(2) I wanted to see if I could get my own, 'missing post' tacked in here
(within my reply) and past the 'censor', whoever he/she might be.

Not meant to single anyone out. Sorry if created that impression. I'm a bit
upset myself with whomever is playing this silly game with me. I didn't see
anything
anywhere near as bad in my posting as I've seen in so many other postings
around here. So I can't really see why my post got cut out - unless someone
afraid of the truth. And who might that be? I mean, who's got the capability
to jump in here anytime and just cut people out? One guess. What next then?

Then again, maybe I'm just going paranoid in my old age and this is all just
one weird coincidence. Who can say.

Anyhow, as I said, thanks for your time and effort. I'm in a bit out of the
way place in Thailand right now and it's not easy to get any kind of help
with technical problems around these parts. I might have possibly not needed
that, were things a bit clearer in the software. I'm not a nuclear physicist
and, unfortunately, do have the sticky fingers, to boot. Be nice to have
clearcut answers like yours to problems such as this right there, via right
click on a Help tag in all those menus one has to wade through.
 
D

DanS

OK. Roger that. And thanx for those keys. I checked all those and
they're OK now after the Restore. At least now I know what to check
next time.

Didn't mean to upset. Replied to both posts here. I'd thought someone
had somehow censored my post to this forum and for some reason
re-submitted it in a shorter and more presentable form when I found
this thread here on basically exact same subject and same date and
time frame.
<SNIP>

I'd say the problem you have with your posting is that you a using the M
$ web-interface to access these newsgroups. This is not a 'forum' on the
M$ website.

It is one of roughly 200,000 newsgroups that make up part of the Interent
call Usenet. There are much better ways of accessing Usenet than through
some web interface.

I saw and read your OP, 'System Restore lies...', and I posted a reply
(albeit not to helpful) as did 2 other people.

There are many newsreaders available that will allow you to participate
in and read Usenet, and I'd have to say that even using Outlook Express
has to be better than a web interface.
 
R

Rhino

tedoniman said:
OK. I'll b(y)te. This is some kind of joke, right? Must have stepped on
someone's
dongle (or worse). 'Rhino' rhymes with 'whiner' (almost) and probably, as
usual,
also, I was a bit to longwinded again. Actually, I try to elaborate as
much
as
possible at one go in a post, to avoid to much back and forth, as that
takes
up
even more of your time.

So if this is some kind of coincidence, let me be the first to apologize;
but it
does look kind of suspicious in that it appears that someone, possibly the
first
respondent or maybe some MS moderator (the kinder term), thought the
question
was poignant but decided to teach me a lesson in manners and brevity by
re-
submitting it here in a much shorter and more complementary form via Mssr
(alias) 'Rhino'. Am I right or am I right?

Uhh, actually it _IS_ a coincidence. Apparently, you and I have similar
problems at roughly the same time. I have never heard of you and didn't know
you had a similar problem: I can't get my batch files to run any more so I
was asking for some help on how to fix that problem. End of story. If anyone
was trying to "teach you a lesson in manners", it wasn't me.

[snip]
 
R

Rhino

null said:
You might try creating a restore point (to backup the registry),
Done.

then opening Regedit, and finding this key:

HKEY_CLASSES_ROOT\.bat

And checking that the (Default) value is set to this:

batfile
That's the value I had for that key.
Under this key:

HKEY_CLASSES_ROOT\batfile\shell

The (Default) value should be:

open
I found that this value was empty; I set it to open and close regedit. I was
still unable to run my batch file so I thought I might need to reboot first
but that didn't help either. But shouldn't I have something like "run" or
"execute" here anyway? Or does that belong in the third key,
HKEY_CLASSES_ROOT\batfile\shell\open\command?

While this key:

HKEY_CLASSES_ROOT\batfile\shell\open\command

Should have a (Default) of:

"%1" %*
That's the exact value I have. Therefore, all three of the keys are the
exact values you suggest but clicking on a bat file still opens it for edit
when I want it to be executed. And I still don't get a Run or Execute
option when I right-click on the batch file.

Any idea what else I need to do?
 
G

Guest

Well thanx for that, DanS. I get your drift. I hope you're right. You know,
I'm not very familiar w/ 'Usenet' nor 'newsreaders'. In the jungle too long.
Tho' someone suggested similar here before and I tried it once, forgot how
now. Just figured out how to use Outlook Express 'though. Might try that -
but where, exactly, to post?

Don't know what happened to YOUR post - unless maybe I guessed right. Or
maybe just an uncanny coincidence.

------------------------------------------------

If you don't mind and if you get this message, I'd just like to note another
weird experience I just had 10 minutes ago in right pane of Explorer window.
My files and sub-folders there came up as icons, instead of my preferred full
detail listing, which
I'd pre-set for ALL folders in 'File and Folder Options' (or something like
that).

From a previous experience and posting on this, I understand it's probably
because
the choices are limited to so many files or folders allowed by pre-set in
Registry. If overflow, it goes to the default icon file/folder display - but
this is correctible via Registry. I've yet to try that.

What I just saw now, though, is slightly different. Right at top of listing,
at left, under "name", I saw the tag "Unspecified". When I clicked on "Name",
the display changed to an alphabetical listing in the format I'll show in a
moment. It just so happened I had only " ... .htm" files in there - so I'm
not sure yet how it would look with mixed, other kinds of files and also
sub-folders in there.

I was unable to change this view back to my favorite, in the normal way, via
File&Folder Options, which always worked OK before in these cases.

All my html file types (downloaded web pages, etc) come in 2 portions - the
actual html part (blue icon) and the 2nd, the graphics part, as represented
by a little yellow folder. I think this is dictated by the settings one ticks
in File & Folder Options\View. The following is *EXACTLY* what I saw, except
that I'm making up the names as I don't recall the actuals. For the html
file icon, I'll put "@"; for the
accompanying little yellow graphics folder icon, I'll put "(YF)":

NAME
Unspecified

A
(YF) Andy's site files etc...
@ Andy's site.htm etc...

B
(YF) Bart'sPlace files etc...
@ Bart'sPlace.htm etc...

C
(YF) CharlieChanMovies files etc...
@ CharlieChanMovies.htm etc...

and so on, in neat alphabetical order, always w/ the order letter
above the group (A, B, C, D, etc.).

Usually, when you click on "Name", the file display order changes or
toggles with each click. The problem is that there's no 'sensible' (to
me, anyway) alphabetic order available.

You can get the FOLDERS listed FIRST in alphabetical order, followed
by the FILES in alphabetical order; but you can't get the FILES listed
FIRST in alphabetical order, followed by FOLDER listing in same order.

When you put the files first, they display in REVERSE alphabetical order.
I'm not sure what brilliant mind at you-know-where came up with that one.

Note: I was refering to a mixed, regular file and sub-folder content under
a main folder, listed in right pane. Not talking about the html thing now.

In this case, though, nothing happens, no matter how many times I click
"name". The listing stays as is - as illustrated above.

Actually, I like this particular listing format - except that (1) I haven't
a clue
how it came about and (2) it allows no other listing-order option.

-------------------------------------------------------------

Now then, assuming you won't clarify this issue for me, how exactly would
I go about posting this query via Outlook Express or the other method you
mention? And would I possibly be vulnerable to excessive SPAM if I did so?

I hope you reply. I'm off and on, on line this evening. It's 22:10 Bangkok
time here now, at my little temporary outpost in Southern Thailand.

I do also have Yahoo Messenger ( (e-mail address removed) ).
Haven't tried the MSN Messenger yet but may soon, as friend here is using it
and says it's OK.
 
G

Guest

Well, glad to meet you, Rhino! For moment I thought someone trying to pull a
fast one on me. Small world. I still don't know what happened. Weird. Maybe I
should have kept it short, exactly like yours.

For your info, just found a great site w/ all knds of 'batchfile' info:

http://www.robvanderwoude.com/index.html

In process of browsing around in there now and checking out all the links.
Looks
promising.

-------------------------------------------------------

Read yr 2nd post just now. Looks like maybe you didn't go back far enough in
time on the "Restore'. It worked for me and all the Registry settings
indicated
by "null" are now exactly as he said.

If you restore again, I'd suggest saving your current batchfile to floppy
first. If
you've read my post, you'll know why. When it came back, it gave me the
'old' version of my batchfile. But maybe there's something wrong with my own
'System Restore' and yours is OK.

OK then. Good luck.

I say, if you've got a good batchfile in the works and don't mind sharing,
let us
know. I'm an old DOS type person myself.

( (e-mail address removed) )
 
G

Guest

Forgot to mention it, but just wondering whether there's some roundabout way
of resetting that particular file association via the 'SET' command.

--
Ted...


Rhino said:
tedoniman said:
OK. I'll b(y)te. This is some kind of joke, right? Must have stepped on
someone's
dongle (or worse). 'Rhino' rhymes with 'whiner' (almost) and probably, as
usual,
also, I was a bit to longwinded again. Actually, I try to elaborate as
much
as
possible at one go in a post, to avoid to much back and forth, as that
takes
up
even more of your time.

So if this is some kind of coincidence, let me be the first to apologize;
but it
does look kind of suspicious in that it appears that someone, possibly the
first
respondent or maybe some MS moderator (the kinder term), thought the
question
was poignant but decided to teach me a lesson in manners and brevity by
re-
submitting it here in a much shorter and more complementary form via Mssr
(alias) 'Rhino'. Am I right or am I right?

Uhh, actually it _IS_ a coincidence. Apparently, you and I have similar
problems at roughly the same time. I have never heard of you and didn't know
you had a similar problem: I can't get my batch files to run any more so I
was asking for some help on how to fix that problem. End of story. If anyone
was trying to "teach you a lesson in manners", it wasn't me.

[snip]
 
R

Rhino

tedoniman said:
Well, glad to meet you, Rhino! For moment I thought someone trying to
pull a
fast one on me. Small world. I still don't know what happened. Weird.
Maybe I
should have kept it short, exactly like yours.

For your info, just found a great site w/ all knds of 'batchfile' info:

http://www.robvanderwoude.com/index.html

In process of browsing around in there now and checking out all the links.
Looks
promising.
That site is full of information on how to write new batch files. In my
case, I'm simply trying to run batch files that came with other programs. If
I can get the file associations fixed, everything will be hunky-dorey. The
batch files themselves aren't complex but I've mangled the Windows
environment in such a way that I can't simply click on batch files to run
them any more and that's what I'm trying to fix.
-------------------------------------------------------

Read yr 2nd post just now. Looks like maybe you didn't go back far enough
in
time on the "Restore'. It worked for me and all the Registry settings
indicated
by "null" are now exactly as he said.

If you restore again, I'd suggest saving your current batchfile to floppy
first. If
you've read my post, you'll know why. When it came back, it gave me the
'old' version of my batchfile. But maybe there's something wrong with my
own
'System Restore' and yours is OK.

OK then. Good luck.

There's nothing wrong with my batch files; it is just the file associations
for batch files that are mangled: when I try to click them to make them run,
they open in an editor instead.
I say, if you've got a good batchfile in the works and don't mind sharing,
let us
know. I'm an old DOS type person myself.

( (e-mail address removed) )
Sorry, I have no batch files to share; I'm simply trying to get existing
batch files that came with other programs to work the way they used to
before I inadvertently mangled my file associations.
 

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