Double-click to run .bat - Windows cannot find file

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 42,998
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #11

    Not uncommon, apparently:
    Double Clicking Batch File Windows cannot find file - Super User

    I tried one logged in as a standard user - location not in system path- worked ok when double clicked.
    Here's how to reset it if associated with e.g. Notepad (which isn't your problem, but for interest)
    - and note 'batfix' - which may be similar to the one from the Tutorial:
    Cant run .bat (Batch Files)

      My Computers


  2. Posts : 5,452
    Windows 11 Home
       #12

    Run CMD as admin and copy/paste, then restart.
    Code:
    sc config TrkWks start= auto
    net start TrkWks
    fsutil usn deletejournal /d /n c:
    chkdsk /scan
      My Computer


  3. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #13

    Rats, that all looks good.

    Since cmd.exe should be executing the batch file, what does where cmd show you in a Command Prompt?
    Mine is:
    >where cmd
    C:\Windows\System32\cmd.exe


    Also, what is %systemroot% set to?
    Mine is:
    >echo %systemroot%
    C:\WINDOWS
      My Computers


  4. Posts : 12
    Windows 10
    Thread Starter
       #14

    TairikuOkami said:
    Run CMD as admin and copy/paste, then restart.
    Code:
    sc config TrkWks start= auto
    net start TrkWks
    fsutil usn deletejournal /d /n c:
    chkdsk /scan
    Ztruker said:
    Rats, that all looks good.

    Since cmd.exe should be executing the batch file, what does where cmd show you in a Command Prompt?
    Mine is:
    >where cmd
    C:\Windows\System32\cmd.exe


    Also, what is %systemroot% set to?
    Mine is:
    >echo %systemroot%
    C:\WINDOWS
    Below are the results of these commands:
    Code:
    C:\Windows\system32>sc config TRkWks start= auto[SC] ChangeServiceConfig SUCCESS
    
    C:\Windows\system32>net start TrkWks
    The requested service has already been started.
    More help is available by typing NET HELPMSG 2182.
    
    C:\Windows\system32>fsutil usn deletejournal /d /n c:
    
    C:\Windows\system32>chkdsk /scan
    The type of the file system is NTFS.
    Volume label is Win 10.
    
    Stage 1: Examining basic file system structure ...
      425984 file records processed.
    File verification completed.
      10186 large file records processed.
      0 bad file records processed.
    
    Stage 2: Examining file name linkage ...
      558648 index entries processed.
    Index verification completed.
      0 unindexed files scanned.
      0 unindexed files recovered to lost and found.
    
    Stage 3: Examining security descriptors ...
    Security descriptor verification completed.
      66333 data files processed.
    CHKDSK is verifying Usn Journal...
      5024 USN bytes processed.
    Usn Journal verification completed.
    
    Windows has scanned the file system and found no problems.
    No further action is required.
    
     249478143 KB total disk space.
     108035960 KB in 296481 files.
        187504 KB in 66334 indexes.
             0 KB in bad sectors.
        502603 KB in use by the system.
         65536 KB occupied by the log file.
     140752076 KB available on disk.
    
          4096 bytes in each allocation unit.
      62369535 total allocation units on disk.
      35188019 allocation units available on disk.
    Code:
    >where cmd
    C:\Windows\System32\cmd.exe
    
    >echo %systemroot%
    C:\Windows

    The problem persists.
      My Computer


  5. Posts : 12
    Windows 10
    Thread Starter
       #15

    The Creators updated installed moments ago.
    bat and cmd files are now working properly again.
      My Computer


  6. Posts : 42,998
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #16

    Reasonable outcome. Should this happen again, and you can't use a restore point, an in-place upgrade repair install should achieve the same. With the CU around now, a 1607 in-place upgrade repair install of a 1607 installation isn't necessarily the first choice.
      My Computers


  7. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #17

    creeve4 said:
    The Creators updated installed moments ago.
    bat and cmd files are now working properly again.
    No no no ... back it out so we can work on this some more!!! JUST KIDDING
    Sure wish we knew what was wrong. Oh well, as long as it's working for you now.
      My Computers


  8. Posts : 12
    Windows 10
    Thread Starter
       #18

    Ztruker said:
    No no no ... back it out so we can work on this some more!!! JUST KIDDING
    Sure wish we knew what was wrong. Oh well, as long as it's working for you now.
    My thoughts exactly! I was tempted to roll it back just so I could figure out what was wrong.
      My Computer


  9. Posts : 1
    Windows
       #19

    Check if the folder still exists


    I had this problem just now and what caused it for me was that I had renamed the folder in a different file explorer window so the folder I was trying to activate the bat file in technically no longer existed. If you are having this problem try closing that file explorer window and opening a new one then navigate to the bat file and try running it again.
      My Computer


  10. Posts : 107
    Windows 10 64 bit Home 22H2 (always completely updated)
       #20

    Hi,

    this is an old thread, but I do suddenly have this problem too: .bat files cannot be found etcetera (or at least some batchfiles I have created myself). Solutions above do, as yet, not work out.

    This problem started occurring last night when I was fumbling around with a self-created batchfile to rename files in folders.

    -restoring an image from six days ago (when this problem did not occur) did not solve my problem. This is very weird to me.

    -two older batchfiles that I run with a .lnk (and set to administrator) work, but not this one with or without a link.

    My systemroot is c:\windows and cmd is c:\windows\system32\cmd.exe

    *I was wondering if an error in the file itself could be the cause, but that cannot be. Windows reports that the file cannot be found (and it is there for sure).

    I am running the latest version fully updated and patched.

    Any help would be appreciated, regards, Kan
      My Computer


 

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

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




Windows 10 Forums