Issues running .bat files


  1. Posts : 3
    Windows 7 x64 Professional
       #1

    I am having a lot of difficulty running batch files. I simply want to create a runonce logon script that will install my .reg file I have created for every user who creates an account on this computer. My file is called c:\tweaks.reg. The file works fine when I double click it or run from command line using regedit /s c:\tweaks.reg.
    When I enter this into a batch file to link to my run once script, it does not work.
    The problem is command prompt appears and disappears instantly without executing the .reg file.
    @echo off
    regedit /s c:\tweaks.reg

    What am I doing wrong? This is happening on both of my Windows 7 systems and one is a fresh installation. Thanks in advance!

    I should note the .bat file is not working running it alone (before putting it into the run once script) so this is not an error in the .reg or the run once script.
      My Computer


  2. Posts : 8,608
    Windows 7 Ultimate 32bit SP1
       #2

    Have you saved the .bat file to notepad? Have you right clicked it and chosen to run as Administrator?
      My Computer


  3. Posts : 72,079
    64-bit Windows 11 Pro for Workstations
       #3

    Hello Jlevitt, and welcome to Seven Forums.

    You could also change the registry settings directly with the batch file instead of trying to run the REG file with the batch file.

    You could type reg add /? in a commmand prompt to see the full usage.

    Reg Add "reg-key" /v ValueName /t TypeOfValue /d DataForValue /f


    If you like, you can edit the BAT files in OPTION THREE of the tutorial below as an example to help.

    Taskbar - Lock or Unlock in Windows 8 - Windows 8 Forums

    Hope this helps,
    Shawn
      My Computer


  4. Posts : 3
    Windows 7 x64 Professional
    Thread Starter
       #4

    Thank you for your response. Yes I saved it as a .bat file after creating it in notepad. I have tried running it as administrator as well to no avail. I have noticed that even trying something as simple as opening cmd.exe with a .bat file does not work either. It pops up briefly and disappears instantly. Example:
    @echo off
    c:\windows\system32\cmd.exe

    I would have to assume there is something set in windows that is preventing execution of a .bat file. This computer is not part of a domain and it was a fresh install. Any ideas?
      My Computer


  5. Posts : 3
    Windows 7 x64 Professional
    Thread Starter
       #5

    Brink,

    Thanks for your response but the issue seems to be that I am unable to execute anything. I have tried your suggestion as well. I have even copied examples of registry commands from other forums to test. The commands work fine if run from cmd.exe, but they do not work from a .bat file.
      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 11:16.
Find Us