Cannot run batch files (.bat)

S

SSC Mike

I have an XP machine that can no longer run .BAT files. When you double
click them the message "Windows Cannot find <filename.bat with path> ...".
This happens with shortcuts and the original file. Strangely, if I start a
command prompt and cd to the folder, the script will run.

I have done the virus scan, and it was negative. Best I can tell, no new
software has been installed recently.

I am assuming something is corrupted, but I am not sure where to start
looking.

Any help would be appreciated.
 
P

Poprivet`

SSC said:
I have an XP machine that can no longer run .BAT
files. When you
double click them the message "Windows Cannot find
<filename.bat with
path> ...". This happens with shortcuts and the
original file.
Strangely, if I start a command prompt and cd to the
folder, the
script will run.

I have done the virus scan, and it was negative.
Best I can tell, no
new software has been installed recently.

I am assuming something is corrupted, but I am not
sure where to start
looking.

Any help would be appreciated.

Sounds like the shortcuts aren't pointing to the bat
file anymore. Has the path to them changed? Check the
shortcut Icon properties, make sure they point to the
bat file/s.
 
S

SSC Mike

Poprivet` said:
Sounds like the shortcuts aren't pointing to the bat
file anymore. Has the path to them changed? Check the
shortcut Icon properties, make sure they point to the
bat file/s.



Problem occurs even if I don't use a shortcut and double click the .bat in Windows explorer.
 
T

Thee Chicago Wolf

Problem occurs even if I don't use a shortcut and double click the .bat in Windows explorer.

Not sure if it's 100% relevant to your situation but you might want to
see what's going on in this KB article:
http://support.microsoft.com/kb/943854

- Thee Chicago Wolf
 
T

Thee Chicago Wolf

Not sure if it's 100% relevant to your situation but you might want to
Looking at the symptoms listed, the hot fix probably would not help. No
messages in the event log either.

Thanks for the thought though.

No problem. Saw it a couple days ago and your .bat issue clicked
something in my head. Have you tried to re-create the shortcuts
already?

- Thee Chicago Wolf
 
S

SSC Mike

Thee Chicago Wolf said:
No problem. Saw it a couple days ago and your .bat issue clicked
something in my head. Have you tried to re-create the shortcuts
already?

- Thee Chicago Wolf

Problem is still there even if I don't use a shortcut and double click the
..bat in Windows explorer.
 
T

Thee Chicago Wolf

Problem is still there even if I don't use a shortcut and double click the
.bat in Windows explorer.

Ok, let's do a file association check. If you open Control Panel >
File Types, you shouldn't see anything for BAT extension on the
visible list.

Try the following:

From a command prompt;
assoc .bat
should return with
...bat=batfile
If not
assoc .bat=batfile
to restore the default file type association.

ftype batfile
should return with
batfile="%1" %*
If not
ftype batfile="%1" %*
to restore the default "Open" action for the file type.

- Thee Chicago Wolf
 
T

Thee Chicago Wolf

Problem is still there even if I don't use a shortcut and double click the
.bat in Windows explorer.

Additionally, verify the following:

HKLM\SOFTWARE\Classes\batfile\shell\open\command
make sure the Reg_Sz
(default)
value data is exactly;
"%1" %*

HKLM\SOFTWARE\Classes\batfile\shell\edit\command
make sure the Reg_Expand_Sz
(default)
value data is exactly;
%SystemRoot%\System32\NOTEPAD.EXE %1


Also look for the key;
...BAT
under
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
and delete the key named
...BAT

- Thee Chicago Wolf
 
T

Thee Chicago Wolf

Problem is still there even if I don't use a shortcut and double click the
.bat in Windows explorer.

Here's a faster solution. Copy and paste the following into notepad
and save it as a .reg file. Then, double-slick the .reg and import it
into your system. I deleted my association to .BAT, tested it and
confirmed it broken, and then ran the .reg file import and it was
restored.


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.bat]
@="batfile"

[HKEY_CLASSES_ROOT\.bat\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

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

[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
@=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,73,00,68,00,\

65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,00,35,\
00,33,00,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\open]
"EditFlags"=hex:00,00,00,00

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

[HKEY_CLASSES_ROOT\batfile\shell\print]

[HKEY_CLASSES_ROOT\batfile\shell\print\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,2f,00,70,00,20,\
00,25,00,31,00,00,00

[HKEY_CLASSES_ROOT\batfile\shellex]

[HKEY_CLASSES_ROOT\batfile\shellex\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers\PifProps]
@="{86F19A00-42A0-1069-A2E9-08002B30309D}"

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers\ShimLayer
Property Page]
@="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"

- Thee Chicago Wolf
 
S

SSC Mike

Thee Chicago Wolf said:
Additionally, verify the following:

HKLM\SOFTWARE\Classes\batfile\shell\open\command
make sure the Reg_Sz
(default)
value data is exactly;
"%1" %*

HKLM\SOFTWARE\Classes\batfile\shell\edit\command
make sure the Reg_Expand_Sz
(default)
value data is exactly;
%SystemRoot%\System32\NOTEPAD.EXE %1


Also look for the key;
...BAT
under
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
and delete the key named
...BAT

- Thee Chicago Wolf
Thanks for the response.

All check out as you listed. There was no ".BAT" key under "FileExts".

Back to the drawing board.
 
T

Thee Chicago Wolf

All check out as you listed. There was no ".BAT" key under "FileExts".
Back to the drawing board.

Try the last one I posed regarding the registry file fix.

- Thee Chicago Wolf
 
E

Elmo

SSC said:
I have an XP machine that can no longer run .BAT files. When you double
click them the message "Windows Cannot find <filename.bat with path> ...".
This happens with shortcuts and the original file. Strangely, if I start a
command prompt and cd to the folder, the script will run.

I have done the virus scan, and it was negative. Best I can tell, no new
software has been installed recently.

I am assuming something is corrupted, but I am not sure where to start
looking.

Any help would be appreciated.

Get the Batch file association fix here.

http://dougknox.com/xp/file_assoc.htm
 
P

Pegasus \(MVP\)

SSC Mike said:
I have an XP machine that can no longer run .BAT files. When you double
click them the message "Windows Cannot find <filename.bat with path> ...".
This happens with shortcuts and the original file. Strangely, if I start
a
command prompt and cd to the folder, the script will run.

I have done the virus scan, and it was negative. Best I can tell, no new
software has been installed recently.

I am assuming something is corrupted, but I am not sure where to start
looking.

Any help would be appreciated.

Create the batch file c:\Test.bat (name & location are important!)
with the following lines inside, then double-click it while in
Windows Explorer:

@echo off
echo Hello world
pause

Does this work or fail?
 
S

SSC Mike

Pegasus (MVP) said:
Create the batch file c:\Test.bat (name & location are important!)
with the following lines inside, then double-click it while in
Windows Explorer:

@echo off
echo Hello world
pause

Does this work or fail?


Tried this and it failed. Same error message.
 
S

SSC Mike

Thee Chicago Wolf said:
Problem is still there even if I don't use a shortcut and double click the
.bat in Windows explorer.

Here's a faster solution. Copy and paste the following into notepad
and save it as a .reg file. Then, double-slick the .reg and import it
into your system. I deleted my association to .BAT, tested it and
confirmed it broken, and then ran the .reg file import and it was
restored.


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.bat]
@="batfile"

[HKEY_CLASSES_ROOT\.bat\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

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

[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
@=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,73,00,68,00,\

65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,00,35,\
00,33,00,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\open]
"EditFlags"=hex:00,00,00,00

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

[HKEY_CLASSES_ROOT\batfile\shell\print]

[HKEY_CLASSES_ROOT\batfile\shell\print\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,2f,00,70,00,20,\
00,25,00,31,00,00,00

[HKEY_CLASSES_ROOT\batfile\shellex]

[HKEY_CLASSES_ROOT\batfile\shellex\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers\PifProps]
@="{86F19A00-42A0-1069-A2E9-08002B30309D}"

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers\ShimLayer
Property Page]
@="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"

- Thee Chicago Wolf
It's working now, but it started working before I had a chance to run your
registry fix. The only 2 things I did in the mean time was backup (export)
the 2 keys you were fixing, and fix a problem I found with a mapped drive.
It seems unlikely that either of these 2 things could have fixed the problem,
but maybe.

Thanks for all the help. The info on the bat file association was something
I wasn't aware of.
 
T

Thee Chicago Wolf

It's working now, but it started working before I had a chance to run your
registry fix. The only 2 things I did in the mean time was backup (export)
the 2 keys you were fixing, and fix a problem I found with a mapped drive.
It seems unlikely that either of these 2 things could have fixed the problem,
but maybe.

Thanks for all the help. The info on the bat file association was something
I wasn't aware of.

No problem. Glad it's working.

- Thee Chicago Wolf
 

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