File associations - open with - context menu

G

Guest

I wished to amend a .BAT file, so opened it with OPEN WITH and selected my
editor (NoteTabPro). Now when I double click on BAT files it opens the file
in the editor instead of running the BAT file. I tried changing the OPEN WITH
to cmd.exe, but that just opens the DOS window. How can I set .BAT files to
run correctly? What should I OPEN WIT?? The old (XP) way to change file
associations doesn't seem to have any effect. Similarly, if I right-click an
HTML file and choose "edit", it opens MS WORD; but I want to use my own
editor (NoteTabPro) - how can I change this setting (again, file associations
don't take). I dare not use OPEN WITH !!!!
 
R

Ramesh, MS-MVP

Download/apply the .BAT file association fix from here.

File association fixes for Windows Vista:
http://www.winhelponline.com/articles/105/1/

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


I wished to amend a .BAT file, so opened it with OPEN WITH and selected my
editor (NoteTabPro). Now when I double click on BAT files it opens the file
in the editor instead of running the BAT file. I tried changing the OPEN WITH
to cmd.exe, but that just opens the DOS window. How can I set .BAT files to
run correctly? What should I OPEN WIT?? The old (XP) way to change file
associations doesn't seem to have any effect. Similarly, if I right-click an
HTML file and choose "edit", it opens MS WORD; but I want to use my own
editor (NoteTabPro) - how can I change this setting (again, file associations
don't take). I dare not use OPEN WITH !!!!
 
G

Guest

Many thanks Ramesh.
I downloaded, unzipped and merged as instructed, and got this message...
"Cannot import C:/.../Desktop/batfix_vista.reg: Not all data was successfully
written to the registry. Some keys are open by the system or other processes."
But it seems to have worked anyway - I can run BAT files again!
 
R

Ramesh, MS-MVP

Thanks for the feedback, Juan.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


Many thanks Ramesh.
I downloaded, unzipped and merged as instructed, and got this message...
"Cannot import C:/.../Desktop/batfix_vista.reg: Not all data was successfully
written to the registry. Some keys are open by the system or other processes."
But it seems to have worked anyway - I can run BAT files again!
 
C

cquirke (MVP Windows shell/user)

On Wed, 28 Mar 2007 04:14:02 -0700, Juan Herrero
I wished to amend a .BAT file, so opened it with OPEN WITH and selected my
editor (NoteTabPro).

Did you clear the "[x] Always open with..." checkbox?
Now when I double click on BAT files it opens the file
in the editor instead of running the BAT file. I tried changing the OPEN WITH
to cmd.exe, but that just opens the DOS window.

..BAT isn't "opened" with CMD.EXE, even though that may be the
interpreter for it, and extra syntax is needed to pass a batch file to
Cmd.exe so that Cmd.exe will invoke it. Cmd.exe %1 won't do it.

Instead, the default is to open .BAT as itself, i.e. the "open" action
is simply %1 (the file itself), just as if it were an .EXE

You can re-assert this via Regedit, or this .REG should do it...

<paste>

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.bat]
@="batfile"

[HKEY_CLASSES_ROOT\batfile]
@="MS-DOS Batch File"
"EditFlags"=hex:30,04,00,00

[HKEY_CLASSES_ROOT\batfile\shell]

[HKEY_CLASSES_ROOT\batfile\shell\edit]

[HKEY_CLASSES_ROOT\batfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\

00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\

54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
00

[HKEY_CLASSES_ROOT\batfile\shell\YourEdit]

[HKEY_CLASSES_ROOT\batfile\shell\YourEdit\command]
@="\"C:\\Path\\To\\Your\\Editor\\YourEdit.exe\" \"%1\""

[HKEY_CLASSES_ROOT\batfile\shell\open]
"EditFlags"=hex:00,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell\open\command]
@="\"%1\" %*"

</paste>

You can edit the "YourEdit" section to taste, to integrate your editor
as a non-defaul rt-click action.
Similarly, if I right-click an HTML file and choose "edit", it opens MS WORD

I know, and it's AWFUL when Word:
- makes it a "special" Word HTML file
- bloats it up several times in size
- drops stuff that triggers risk-management heuristics

Word is unfit for use as an HTML editor, because it just doesn't "get"
the idea behind HTML; great portability across platforms, and flexible
appearance. Instead, the Word team try to do DTP with it.
but I want to use my own editor (NoteTabPro) - how can I change this
setting (again, file associations don't take).

For HTML, it can be trickier - I know, I want to use Front Page
Express, but it takes a bit of tap-dancing to get it to appear as a
choice within IE's "Programs" list for editing HTML.
I dare not use OPEN WITH !!!!

Yep, Open With (when [x] Always use...) is a stone-age club.


--------------- ---- --- -- - - - -
Saws are too hard to use.
Be easier to use!
 
G

Guest

Thanks for the extra info.

The "[x] Always open with..." checkbox has a habit of being greyed out and
unclearable!!!

The BAT problem was solved by Ramesh's download (see other messages).

As to context menus, I found a reference elsewhere which pointed me at
creativelement.com powertools, which does the job admirably, and I now have
"Edit" entries in context menus to my satisfaction. It also enabled me to
change the icons for filetypes, which I was about to give up on!


cquirke (MVP Windows shell/user) said:
On Wed, 28 Mar 2007 04:14:02 -0700, Juan Herrero
I wished to amend a .BAT file, so opened it with OPEN WITH and selected my
editor (NoteTabPro).

Did you clear the "[x] Always open with..." checkbox?
Now when I double click on BAT files it opens the file
in the editor instead of running the BAT file. I tried changing the OPEN WITH
to cmd.exe, but that just opens the DOS window.

..BAT isn't "opened" with CMD.EXE, even though that may be the
interpreter for it, and extra syntax is needed to pass a batch file to
Cmd.exe so that Cmd.exe will invoke it. Cmd.exe %1 won't do it.

Instead, the default is to open .BAT as itself, i.e. the "open" action
is simply %1 (the file itself), just as if it were an .EXE

You can re-assert this via Regedit, or this .REG should do it...

<paste>

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.bat]
@="batfile"

[HKEY_CLASSES_ROOT\batfile]
@="MS-DOS Batch File"
"EditFlags"=hex:30,04,00,00

[HKEY_CLASSES_ROOT\batfile\shell]

[HKEY_CLASSES_ROOT\batfile\shell\edit]

[HKEY_CLASSES_ROOT\batfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\

00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\

54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
00

[HKEY_CLASSES_ROOT\batfile\shell\YourEdit]

[HKEY_CLASSES_ROOT\batfile\shell\YourEdit\command]
@="\"C:\\Path\\To\\Your\\Editor\\YourEdit.exe\" \"%1\""

[HKEY_CLASSES_ROOT\batfile\shell\open]
"EditFlags"=hex:00,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell\open\command]
@="\"%1\" %*"

</paste>

You can edit the "YourEdit" section to taste, to integrate your editor
as a non-defaul rt-click action.
Similarly, if I right-click an HTML file and choose "edit", it opens MS WORD

I know, and it's AWFUL when Word:
- makes it a "special" Word HTML file
- bloats it up several times in size
- drops stuff that triggers risk-management heuristics

Word is unfit for use as an HTML editor, because it just doesn't "get"
the idea behind HTML; great portability across platforms, and flexible
appearance. Instead, the Word team try to do DTP with it.
but I want to use my own editor (NoteTabPro) - how can I change this
setting (again, file associations don't take).

For HTML, it can be trickier - I know, I want to use Front Page
Express, but it takes a bit of tap-dancing to get it to appear as a
choice within IE's "Programs" list for editing HTML.
I dare not use OPEN WITH !!!!

Yep, Open With (when [x] Always use...) is a stone-age club.


--------------- ---- --- -- - - - -
Saws are too hard to use.
Be easier to use!
--------------- ---- --- -- - - - -
 
C

cquirke (MVP Windows shell/user)

On Thu, 29 Mar 2007 08:00:01 -0700, Juan Herrero
The "[x] Always open with..." checkbox has a habit of being greyed out and
unclearable!!!

Hmmm... that could be a protective EditFlags setting...
The BAT problem was solved by Ramesh's download (see other messages).

I see now, yes - good one!
As to context menus, I found a reference elsewhere which pointed me at
creativelement.com powertools, which does the job admirably, and I now have
"Edit" entries in context menus to my satisfaction. It also enabled me to
change the icons for filetypes, which I was about to give up on!

Regedit's tough for those things, and I miss the "old" File Types UI
in Vista... thanks for the link, I'm downloading it now :)

File associations can get brittle, and they changed in XP from being a
single HKLM subtree that is mirrored as HKCR, to HKCR as a merging of
both HKLM and new-for-XP HKCU material.

Just how the HKCU and HKLM material interact, both as direct overlays
and across parent-child inheritance, may be hard to predict - so I'm
hoping that this toolset will be aware of these changes.

Hmm... very nice! I like the linkage down to Regedit. Could be a
must-have for Vista... I also like the way various tools can be
selected and deselected from the control panel, making it a bit safer
for tech-and-user scenarios.

Thanks!


--------------- ---- --- -- - - - -
"We have captured lightning and used
it to teach sand how to think."
 

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