.bat reg import gives error accessing the registry

Page 1 of 2 12 LastLast

  1. Posts : 8
    Windows 7 Ultimate x64
       #1

    .bat reg import gives error accessing the registry


    Hello everyone, im new here!
    now, ive got a .reg file that id like to import automatically via .bat file to the registry.
    if i type the code myself in CMD it does work, but the same code via the .bat file refuses to add and
    get the error of: error accessing the registry

    im using the code : reg import *****.reg

    does anybody knows what seems to be the problem?

    thanks!
      My Computer


  2. Posts : 10,485
    W7 Pro SP1 64bit
       #2

    Welcome to the Seven Forums.

    The batch file will need to be run with elevated privileges.
    Elevated Command Prompt
      My Computer


  3. Posts : 8
    Windows 7 Ultimate x64
    Thread Starter
       #3

    thank you!

    i had thought of that and it still isnt working. nevertheless, the .bat file is meant to start automatically as a part of startup program

    is there any other idea?

    thank you for trying though!
      My Computer


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    I don't know of a way to do that.

    Having an executable (the batch file) automatically elevate its privileges (without user interaction) seems to be something that a virus would like to do - so, I think that the W7 operating system security model prevents that from happening.
      My Computer


  5. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #5

    UsernameIssues said:
    I don't know of a way to do that.

    Having an executable (the batch file) automatically elevate its privileges (without user interaction) seems to be something that a virus would like to do - so, I think that the W7 operating system security model prevents that from happening.
    Post the bat file please. I can't understand why you want to modify registry on each startup.
    What do you mean by running it "on startup"? On system startup or on windows logon?
      My Computer


  6. Posts : 4,566
    Windows 10 Pro
       #6

    You cannot make a command prompt auto elevate itself (that would be bad for many reasons), but you can make it prompt/ask for it, which is a one click yes on the yes button for UAC.
    (If you are an admin, otherwise standard users would be prompted for admin credentials.)

    See this code attached and add it to the beginning of the batch file.

    However, if you run the bat file through group policy at login script or by way of the task scheduler at login, you could bypass UAC and run it regardless of the users settings being admin or standard user.
    .bat reg import gives error accessing the registry Attached Files
      My Computer


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

    Kaktussoft said:
    I can't understand why you want to modify registry on each startup.
    What do you mean by running it "on startup"? On system startup or on windows logon?
    not on every startup. i would like to have it run when i choose to by starting another program that also execute the batch file and add something to the registry.
    its of no concern though, even when im trying to REG ADD through the .bat it gives me an error

    andrew129260 said:
    if you run the bat file through group policy at login script or by way of the task scheduler at login, you could bypass UAC and run it regardless of the users settings being admin or standard user.
    thank you for trying to help!
    i have downloaded the txt and added it to the batch file and its still gives me the accessing registry error.

    whats that about the group policy?
    btw, i am the admin of this machine.

    i have tried to make it cumbersome a little bit, thinking it would bypass the problem by using the command "start" and then having to click Yes in order for it to be added to the registry, but it still gives me the same error unfortunately
    Last edited by aVco; 29 Jan 2014 at 07:23.
      My Computer


  8. Posts : 10,485
    W7 Pro SP1 64bit
       #8

    aVco said:
    ~~~
    i would like to have it run when i choose to by starting another program that also execute the batch file and add something to the registry.
    ~~~
    Something like this could be used to get around tracking the trial period for software.

    We will need details...
    What program are you talking about?
    What info needs to be changed in the registry?
    Does the info need to be changed before the program starts?

    ...before we can continue to help.
      My Computer


  9. Posts : 8
    Windows 7 Ultimate x64
    Thread Starter
       #9

    UsernameIssues said:
    We will need details...
    What program are you talking about?
    What info needs to be changed in the registry?
    Does the info need to be changed before the program starts?

    ...before we can continue to help.
    well, there is a way to enter safemode within msconfig and so id like to be able to run
    a batch file after marking the V, that will disable that option from within the registry right after
    i get into the safemode.
    theres no info needs to be changed, only added

    if any more information is needed, please ask

    i didnt explain it before because it sounds a bit complicated, but still after everything i have tried the
    problem remains when i try to add or import.
      My Computer


  10. Posts : 10,485
    W7 Pro SP1 64bit
       #10

    My guess is that you are seeing ERROR: Error accessing the registry because your account does not have permissions to change that part of the registry. What registry key are you working under?
      My Computer


 
Page 1 of 2 12 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 12:50.
Find Us