Can't run .bat files

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #11

    Post the contents of the batch file.

    Double clicking a .bat file now opens the command processor, but the file still does not run. This might be because when running the .reg file I get messages that some keys cannot be imported because they are in use. However, I don't know how to get past this problem, because from my perspective I'm not running anything at the time. There are no apps running in task manager. I've tried running regedit in Safe mode but it produces the same messages.
    Did you ever get round that problem? If not try RegOwnershipEx:

    help installing lines to register

    Navigate to and take ownership of HKEY_CLASSES_ROOT\batfile\

    Leave the program running and merge your reg file. Then restore ownership.
    Last edited by Callender; 21 Feb 2015 at 12:37. Reason: correct a typo
      My Computer


  2. Posts : 11
    windows 7 64
    Thread Starter
       #12

    It's every .bat file.
    Moving to the desktop does not change anything.
      My Computer


  3. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #13

    Also do you have this shown in Environment Variables?

    Can't run .bat files-ev2.jpg

    Can't run .bat files-ev.jpg
      My Computer


  4. Posts : 11
    windows 7 64
    Thread Starter
       #14

    Yes, I have .BAT in my PATHEXT.

    Just to summarise where I am....
    No .bat files will run when double-clicked or "Open"-ed.
    A .bat file can be run by right-clicking and using "Run As Administrator".
    A .bat file will run in the command processor (standard or elevated) using the full path to the file.

    I have googled this extensively over 3 days and can find similar problems. But suggestions stop once it reaches the same point as I am now.
      My Computer


  5. Posts : 72,052
    64-bit Windows 11 Pro for Workstations
       #15

    Peter,

    If you haven't already, you might see if doing a system restore using a restore point dated before this started happening may be able undo and fix it.
      My Computer


  6. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #16

    Hi Peter,

    Check your batch files' open command string.

    In a command prompt type the following,
    Code:
    ftype batfile
    Post back the result.
      My Computer


  7. Posts : 25,847
    Windows 10 Pro. 64/ version 1709 Windows 7 Pro/64
       #17

    I'm no expert on .bat files but because of this I think you have a privilege problem not a .bat problem.

    From post #5

    I have since discovered that if I rightclick a .bat file and 'Run As Administrator' the file runs. However, my research suggest that it is impossible to set cmd.exe to run as admin automatically.
    I will go back to watching and leave my thoughts to the experts.
      My Computer


  8. Posts : 11
    windows 7 64
    Thread Starter
       #18

    Layback Bear
    I am slowly coming to the same conclusion. Unfortunately it doesn't move me on at all as the only things I know about are UAC control settings and Run as Admin. I have set UAC to the lowest level and Run As Admin can't be set on cmd.exe. I even tried to copy cmd.exe out of system32 , set Run as Admin on the copy (which I could do) and then copy it back in. But Of course I can't paste anything INTO system32.
      My Computer


  9. Posts : 11
    windows 7 64
    Thread Starter
       #19

    pyprohly Thanks for the suggestion. Already been there though.
    Attached Thumbnails Attached Thumbnails Can't run .bat files-bat4.png  
      My Computer


  10. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #20

    Okay. Those look good.

    Now lets check the %ComSpec% variable...
    Code:
    echo %COMSPEC%
      My Computer


 
Page 2 of 3 FirstFirst 123 LastLast

  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 09:38.
Find Us