Gary Connor, Phd.
asked on
Unable to EDIT a batch file.
I am suddenly unable to edit batch files on my computer. If I change the file extension to ".txt" I can edit the file and rename it to ".bat". However, if the file has the ".bat" file extension I get an "access denied" error whether I try to run the batch file or try to edit the batch file.
Even if I create a new file, enter some commands, and then save the file as a batch file, I am subsequently unable to Open or Edit the file, even though it is a file I just finished creating.
Even if I create a new file, enter some commands, and then save the file as a batch file, I am subsequently unable to Open or Edit the file, even though it is a file I just finished creating.
Right click the batch file and go to properties. Then go to the security tab and make sure you have full control over the file.
Is there some AntiVirus software running? It might try to act on .bat and .cmd, holding them locked for scanning, or blocking access completely.
ASKER
Yes, I have "Full Control" access to the file (thus I am able to create and edit it as a .txt file).
We have Symantec Endpoint Protection running on all machines, with a centralized policy server. My machine is the only one upon which I am unable to even edit a batch file. If I disable Symantec Endpoint Protection I still get an "access denied" on the file if it is named *.bat, but have no problems editing it when I change the extension.
We have Symantec Endpoint Protection running on all machines, with a centralized policy server. My machine is the only one upon which I am unable to even edit a batch file. If I disable Symantec Endpoint Protection I still get an "access denied" on the file if it is named *.bat, but have no problems editing it when I change the extension.
ASKER
My research throughout the day leads me to believe this is some sort of registry problem, but I can't find anything more specific.
What type association do you have on .bat files?
right-click on file, select properties, general tab.
entry for "type of file"?
right-click on file, select properties, general tab.
entry for "type of file"?
ASKER
"MS-DOS Batch File" (no quotes)
I agree with Qlemo, sounds like some kind of malware protecting software on the PC may be restricting access to BAT files.
One question, do you have the same problem with CMD extension files?
How about say VBS extension files?
Also, could you run the following two cmmands at a command prompt and copy up the output here?
assoc .bat
ftype batfile
Have you tried running the BAT file from a command shell window, or only from Explorer?
~bp
One question, do you have the same problem with CMD extension files?
How about say VBS extension files?
Also, could you run the following two cmmands at a command prompt and copy up the output here?
assoc .bat
ftype batfile
Have you tried running the BAT file from a command shell window, or only from Explorer?
~bp
ASKER
C:\Documents and Settings\gary>assoc bat
File association not found for extension bat
C:\Documents and Settings\gary>ftype batfile
batfile="%1" %*
Checking on cmd and vbs now...
File association not found for extension bat
C:\Documents and Settings\gary>ftype batfile
batfile="%1" %*
Checking on cmd and vbs now...
ASKER
No problems with .cmd or .vbs files - I can edit and execute both.
Does it give the error when you Run "notepad thefile.bat" or just if you "Edit" it in from Windows Explorer? If the latter, then it would be the way the Edit verb is registered to .bat file type.
==> gary_connor:
==> C:\Documents and Settings\gary>assoc bat
==> File association not found for extension bat
You forgot the period before the BAT, please repeat as:
assoc .bat
~bp
==> C:\Documents and Settings\gary>assoc bat
==> File association not found for extension bat
You forgot the period before the BAT, please repeat as:
assoc .bat
~bp
ASKER
If I run ""notepad thefile.bat" or open notepad and open the file from within NotePad there is no problem. Since your obviously thinking in the right direction, I tried and found that I ca directly execute the bat file from a command prompt.
It seems that both the open and the edit problems only occur in explorer.
It seems that both the open and the edit problems only occur in explorer.
ASKER
..also (sorry, I missed this one before):
C:\Documents and Settings\gary>assoc.bat
.bat=batfile
C:\Documents and Settings\gary>assoc.bat
.bat=batfile
ASKER
... and I suppose only Batman can use batfiles?
Okay, basic association seems correct.
What version of Windows are you running?
~bp
What version of Windows are you running?
~bp
:-) I like that one!
ASKER
Windows XP with SP3.
So, in Windows Explorer, if you do Tools, Folder Options, File Type, is there an entry for BAT files in the list?
~bp
~bp
ASKER
NO :- (
That's actually right, it shouldn't be in there.
~bp
~bp
ASKER
My wife just said to tell you that "changing the spark plugs" always works.
Ha, not now adays, plugs last a long time now...
Okay, you might want to grab the NirSoft utility at this page and run it, seeing if it shows info for BAT files.
http://www.nirsoft.net/utils/file_types_manager.html
There's no installation for this, just extract the files from the zip to a folder and run the EXE.
~bp
http://www.nirsoft.net/utils/file_types_manager.html
There's no installation for this, just extract the files from the zip to a folder and run the EXE.
~bp
ASKER
For .bat files it shows:
edit edit No No 3/26/2009 4:17:39 PM %SystemRoot%\System32\NOTE PAD.EXE %1
open open No No 3/26/2009 4:17:39 PM "%1" %*
print print No No 3/26/2009 4:17:39 PM %SystemRoot%\System32\NOTE PAD.EXE /p %1
edit edit No No 3/26/2009 4:17:39 PM %SystemRoot%\System32\NOTE
open open No No 3/26/2009 4:17:39 PM "%1" %*
print print No No 3/26/2009 4:17:39 PM %SystemRoot%\System32\NOTE
Here's what it looks like on one of my XP systems here for the BAT extension, see if it matches yours, or you see any clues.
~bp
bat.htm
~bp
bat.htm
Hmmm, that seems reasonable...
~bp
~bp
ASKER
ASKER
They look identical to me.
How about in the top section, does it look something like this?
.bat batfile MS-DOS Batch File 0x00000430 0x00000000 %SystemRoot%\System32\shel l32.dll,-1 53 11/16/2006 8:57:02 PM Standard Microsoft® Windows® Operating System 6.00.2900.5622 (xpsp_sp3_gdr.080617-1319) Windows Shell Common Dll Microsoft Corporation
~bp
.bat batfile MS-DOS Batch File 0x00000430 0x00000000 %SystemRoot%\System32\shel
~bp
ASKER
Our icon IDs are are different, but otherwise everything is identical.
ASKER
.bat batfile MS-DOS Batch File * 0x00000430 0x00000008 C:\WINDOWS\system32\shell3 2.dll,71 3/26/2009 4:17:38 PM Standard Microsoft® Windows® Operating System 6.00.2900.5622 (xpsp_sp3_gdr.080617-1319) Windows Shell Common Dll Microsoft Corporation
ASKER
The asterik in mine is under the column heading "Always Show Extension."
ASKER
Under "Browser flags" mine has "0x00000008" while yours has "0x00000000"
Well, that all seems to jive with a working system.
The fact that you can edit it from notepad directly, and run it from a command prompt seems to point away from an anti-virus program blocking it. Seems to point more toward the way Windows Explorer is handling that file extension, but we have checked the obvious stuff there.
Hmmmm...
~bp
The fact that you can edit it from notepad directly, and run it from a command prompt seems to point away from an anti-virus program blocking it. Seems to point more toward the way Windows Explorer is handling that file extension, but we have checked the obvious stuff there.
Hmmmm...
~bp
ASKER
Having changed the Browser Flags to match yours I can now execute the file from explorer, I simply can't right-click and choose "Edit." I can open notepad and open the file from within notepad.
Half my problems solved - with a work-around for the right-click to edit.
Half my problems solved - with a work-around for the right-click to edit.
Well, that's encouraging. I was looking for docs on the bits in the browser flags, but hadn't found a reference for them yet.
~bp
~bp
If you right click, in the pop up menu is there an "edit with..." or "open with..." option, or just "edit"?
~bp
~bp
ASKER
Interestingly enough, If I right-click choose "Edit" I get the access denied, but if I right-click and choose a text editor everything works fine. While there is clearly a problem with my system, I would probably call this one solved, especially considering the category within which it is posted.
I found this on the EditFlags, but yours and mine seem to match 0430, so not sure this is the problem...
~bp
~bp
If you have no program accociated with the .bat filytype, how are you getting the "edit" option? You should be getting only "edit with..."
ASKER
So, it appears to me that everything works, but that the right click "Edit" command must pass in a parameter to a non-existent program (which is easy to work around)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
"She Who Rules" calls me to dinner - I will compare registry entries and see if I can fix things - will post again tomorrow morning, and mark this solved either way.
One other long shot. In the registry, make sure there isn't a .BAT under:
HKCU\Software\Microsoft\Wi ndows\Curr entVersion \Explorer\ FileExts
if there is, remove it.
~bp
HKCU\Software\Microsoft\Wi
if there is, remove it.
~bp
Okay, enjoy eats, and good luck!
~bp
~bp
ASKER
Can't thank you enough - I made a little .reg file from the info you sent, entered it, and now everything works perfectly! You should be a GURU. Seriously, thank you.
ASKER
Great at logically stepping me through the issues involved to find exactly what the problem was, and then showing me explicitly how to fix it. What a GREAT experience. If only more tech support was like this !
Excellent, pleasant response on this question this morning, brightened my day to see you had the problem resolved.
Thanks much for the glowing comments in the accepted solution too, while those aren't publicly visible I appreciate the kind words, and I'm glad we were able to work it to a solution.
~bp
Thanks much for the glowing comments in the accepted solution too, while those aren't publicly visible I appreciate the kind words, and I'm glad we were able to work it to a solution.
~bp