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


  1. Posts : 5
    Windows Ultimate x64
       #1

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


    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


  2. Posts : 2,177
    Windows 8.1 Pro x64
       #2

    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?
    Screenshots and Files - Upload and Post in Seven Forums

    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
      My Computer


  3. Posts : 5
    Windows Ultimate x64
    Thread Starter
       #3

    JDobbsy1987 said:
    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?
    Screenshots and Files - Upload and Post in Seven Forums

    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


  4. Posts : 2,177
    Windows 8.1 Pro x64
       #4

    Can you please clarify what you mean by it works when you do a direct access to the file?

    Regards,
    Jamie
      My Computer


  5. Posts : 5
    Windows Ultimate x64
    Thread Starter
       #5

    JDobbsy1987 said:
    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


  6. Posts : 21,482
    Win 7 x64 Home Premium (and x86 VirtualBox VM)/Win10
       #6

    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


  7. Posts : 5
    Windows Ultimate x64
    Thread Starter
       #7

    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


  8. Posts : 21,482
    Win 7 x64 Home Premium (and x86 VirtualBox VM)/Win10
       #8

    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 by NoelDP; 02 Aug 2014 at 01:48. Reason: correct ttpyo in command
      My Computer


  9. Posts : 5
    Windows Ultimate x64
    Thread Starter
       #9

    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


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:24.
Find Us