Windows can't find the file when trying to run a .bat file

rush77

New member
Local time
9:18 AM
Messages
5
When I double click a .bat file windows says it can't find it, but if I do a direct access to the file then it runs it without any problem. Any idea?

Tanks!
 

My Computer My Computer

At a glance

Windows Ultimate x64
Computer type
PC/Desktop
OS
Windows Ultimate x64

My Computer My Computer

At a glance

Windows 8.1 Pro x64Intel Core i5-2500K @ 3.30GHz - S11558GB Corsair DDR3 XMS3, PC3-12800NVIDIA GeForce GTX 650
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 8.1 Pro x64
CPU
Intel Core i5-2500K @ 3.30GHz - S1155
Motherboard
Asus P8P67 LE Rev3, Intel P67, S115
Memory
8GB Corsair DDR3 XMS3, PC3-12800
Graphics Card(s)
NVIDIA GeForce GTX 650
Sound Card
On-Board
Monitor(s) Displays
3 x 24" {Extended Display}
Screen Resolution
1920 x 1080
Hard Drives
300GB Seagate Barracuda 7200
PSU
550W Coolermaster GX550
Case
Silverstone Precision PS04B
Cooling
Stock
Keyboard
Logitech K120
Mouse
World of Warcraft Cataclysm MMO Gaming Mouse
Internet Speed
80 MB
Antivirus
MSE / Windows Defender
Browser
Chrome
Hi and Welcome to SevenForums.

Can you please post a screen shot of the error you are getting as i'm not quite sure what you mean?
http://www.sevenforums.com/tutorials/9733-screenshots-files-upload-post-seven-forums.html

Can it not find the actual bat file you are double clicking or a file that the script in the bat file is trying to reference?

Regards,
Jamie

It can't find the file I'm double clicking.
My Windows 7 is the spanish version, so I don't know if the scrrenshot will be of help.
 

My Computer My Computer

At a glance

Windows Ultimate x64
Computer type
PC/Desktop
OS
Windows Ultimate x64
Can you please clarify what you mean by it works when you do a direct access to the file?

Regards,
Jamie
 

My Computer My Computer

At a glance

Windows 8.1 Pro x64Intel Core i5-2500K @ 3.30GHz - S11558GB Corsair DDR3 XMS3, PC3-12800NVIDIA GeForce GTX 650
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 8.1 Pro x64
CPU
Intel Core i5-2500K @ 3.30GHz - S1155
Motherboard
Asus P8P67 LE Rev3, Intel P67, S115
Memory
8GB Corsair DDR3 XMS3, PC3-12800
Graphics Card(s)
NVIDIA GeForce GTX 650
Sound Card
On-Board
Monitor(s) Displays
3 x 24" {Extended Display}
Screen Resolution
1920 x 1080
Hard Drives
300GB Seagate Barracuda 7200
PSU
550W Coolermaster GX550
Case
Silverstone Precision PS04B
Cooling
Stock
Keyboard
Logitech K120
Mouse
World of Warcraft Cataclysm MMO Gaming Mouse
Internet Speed
80 MB
Antivirus
MSE / Windows Defender
Browser
Chrome
Can you please clarify what you mean by it works when you do a direct access to the file?

Regards,
Jamie

Sorry. I meant a shortcut. If I create a shortcut to the .bat file then it runs without problems.
 

My Computer My Computer

At a glance

Windows Ultimate x64
Computer type
PC/Desktop
OS
Windows Ultimate x64
Sounds like your environment variables have been changed, and the double-click is not opening the CMD properly.

Please open an Elevated Command Prompt, and run the following commands

REG QUERY HKEY_CLASSES_ROOT\.bat /S
REG QUERY HKEY_CLASSES_ROOT\.cmd /S
REG QUERY "HKCU\Volatile Environment" /S


Post the results.


Here are some instructions to make life easier :)
1) To open an Elevated Command Prompt Window (the ECP window), click on Start, All Programs, Accessories – then right-click on Command Prompt, and select Run as Administrator. Accept the UAC prompt.
2) To run the commands easier, highlight the block of commands, and right-click on the highlight – select Copy. In the CP Window, click on the black/white icon at top left – select Paste. The commands will run but may not complete the last command, so hit the Enter Key once.
3) To copy the results... click on the Black/White icon in the top left, and select Edit... 'Select All', and hit the Enter key - then use Ctrl+V or r-click+Paste to paste it into your response.
 

My Computer My Computer

At a glance

Win 7 x64 Home Premium (and x86 VirtualBox VM...i3 370M/i7 6500U8GB - finally :)/8GBit's an i3, dude!/dual Intel&nVidia
Computer type
Laptop
Computer Manufacturer/Model Number
Asus K52F or Lenovo B51-80
OS
Win 7 x64 Home Premium (and x86 VirtualBox VM)/Win10
CPU
i3 370M/i7 6500U
Motherboard
Asus/Lenovo
Memory
8GB - finally :)/8GB
Graphics Card(s)
it's an i3, dude!/dual Intel&nVidia
Sound Card
onboard
Monitor(s) Displays
15.6" built-in
Screen Resolution
1366x768/1920x1080
Hard Drives
750GB Seagate internal
Sundry external drives attached to other computers on the local network
1TB SSD on the Lenovo
PSU
n/a
Internet Speed
as much as I can get - usually on a dongle/phone, so <1MB/s
Antivirus
MSE/Defender
Browser
IE11/12/Edge/Chrome/FF(if I must)
Code:
C:\Users\Roger>REG QUERY HKEY_CLASSES_ROOT\.bat /S

HKEY_CLASSES_ROOT\.bat
    (Predeterminado)    REG_SZ    batfile

HKEY_CLASSES_ROOT\.bat\PersistentHandler
    (Predeterminado)    REG_SZ    {5e941d80-bf96-11cd-b579-08002b30bfeb}


C:\Users\Roger>REG QUERY HKEY_CLASSES_ROOT\.cmd /S

HKEY_CLASSES_ROOT\.cmd
    (Predeterminado)    REG_SZ    cmdfile

HKEY_CLASSES_ROOT\.cmd\PersistentHandler
    (Predeterminado)    REG_SZ    {5e941d80-bf96-11cd-b579-08002b30bfeb}


C:\Users\Roger>REG QUERY "HKCU\Volatile Environment" /S

HKEY_CURRENT_USER\Volatile Environment
    LOGONSERVER    REG_SZ    \\2500K
    USERDOMAIN    REG_SZ    2500k
    USERNAME    REG_SZ    Roger
    USERPROFILE    REG_SZ    C:\Users\Roger
    HOMEPATH    REG_SZ    \Users\Roger
    HOMEDRIVE    REG_SZ    C:
    APPDATA    REG_SZ    C:\Users\Roger\AppData\Roaming
    LOCALAPPDATA    REG_SZ    C:\Users\Roger\AppData\Local

HKEY_CURRENT_USER\Volatile Environment\1
    SESSIONNAME    REG_SZ    Console
    CLIENTNAME    REG_SZ


C:\Users\Roger>

This are the results, but had no luck with double clicking .bat files: I get the same error.

It's an error window that says something like:

Code:
Windows can't find the file "filename.bat"
Make sure filename it's written correctly and try again.

filename.bat is the name of the file I'm double clicking.

(I'm translating from spanish so maybe in english it's not exactly the same message.)
 

My Computer My Computer

At a glance

Windows Ultimate x64
Computer type
PC/Desktop
OS
Windows Ultimate x64
Hmmm - that's normal.

Let's look a little deeper...

Open an Elevated Command Prompt, and run the following commands.
Code:
REG QUERY HKCR\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}
REG QUERY HKCR\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} /S
REG QUERY HKCR\CLSID\{DD75716E-B42E-4978-BB60-1497B92E30C4}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}
REG QUERY HKCR\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}
 
.

post the results
 
Last edited:

My Computer My Computer

At a glance

Win 7 x64 Home Premium (and x86 VirtualBox VM...i3 370M/i7 6500U8GB - finally :)/8GBit's an i3, dude!/dual Intel&nVidia
Computer type
Laptop
Computer Manufacturer/Model Number
Asus K52F or Lenovo B51-80
OS
Win 7 x64 Home Premium (and x86 VirtualBox VM)/Win10
CPU
i3 370M/i7 6500U
Motherboard
Asus/Lenovo
Memory
8GB - finally :)/8GB
Graphics Card(s)
it's an i3, dude!/dual Intel&nVidia
Sound Card
onboard
Monitor(s) Displays
15.6" built-in
Screen Resolution
1366x768/1920x1080
Hard Drives
750GB Seagate internal
Sundry external drives attached to other computers on the local network
1TB SSD on the Lenovo
PSU
n/a
Internet Speed
as much as I can get - usually on a dongle/phone, so <1MB/s
Antivirus
MSE/Defender
Browser
IE11/12/Edge/Chrome/FF(if I must)
Results:

Code:
Microsoft Windows [Versión 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.

C:\Users\Roger>REG QUERY HKCR\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}\Persi
stentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}

HKEY_CLASSES_ROOT\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}\PersistentAddinsR
egistered\{89BCB740-6119-101A-BCB7-00DD010655AF}
    (Predeterminado)    REG_SZ    {c1243ca0-bf96-11cd-b579-08002b30bfeb}


C:\Users\Roger>REG QUERY HKCR\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} /S

HKEY_CLASSES_ROOT\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}
    (Predeterminado)    REG_SZ    Plain Text filter
    LocalizedString    REG_SZ    @query.dll,-511

HKEY_CLASSES_ROOT\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}\InprocServer32
    (Predeterminado)    REG_EXPAND_SZ    %systemroot%\system32\query.dll
    ThreadingModel    REG_SZ    Both


C:\Users\Roger>REG QUERY HKCR\CLSID\{DD75716E-B42E-4978-BB60-1497B92E30C4}\Persi
stentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}

HKEY_CLASSES_ROOT\CLSID\{DD75716E-B42E-4978-BB60-1497B92E30C4}\PersistentAddinsR
egistered\{89BCB740-6119-101A-BCB7-00DD010655AF}
    (Predeterminado)    REG_SZ    {c1243ca0-bf96-11cd-b579-08002b30bfeb}


C:\Users\Roger>REG QUERY HKCR\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b3
0bfeb}

HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}
    (Predeterminado)    REG_SZ    Plain Text filter
    LocalizedString    REG_SZ    @query.dll,-511

HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}\Inpro
cServer32

Still no luck. But now if I right click the .bat file and select run as administrator it runs...
I noticed that if a programs tries to run a .bat it says that it can't find the file, but I'm sure it's there.
 

My Computer My Computer

At a glance

Windows Ultimate x64
Computer type
PC/Desktop
OS
Windows Ultimate x64
Back
Top