.bat reg import gives error accessing the registry

aVco

New member
Local time
9:35 AM
Messages
8
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 My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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 My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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 My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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 My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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.
 

Attachments

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Built
OS
Windows 10 Pro
CPU
AMD Ryzen 5 2400G Processor with Radeon RX Vega 11 Graphics
Motherboard
ASRock X470 Master SLI/AC AM4 AMD Promontory X470 SATA 6Gb/s
Memory
G.SKILL Ripjaws V Series 16GB (2 x 8GB) 288-Pin DDR4 SDRAM D
Graphics Card(s)
2047MB NVIDIA GeForce GTX 1060 6GB (EVGA)
Sound Card
Motherboard Built in
Monitor(s) Displays
Acer R240HY bidx 23.8-Inch IPS HDMI DVI VGA (1920 x 1080) Wi
Screen Resolution
1920 x 1080
Hard Drives
1TB Sandisk SSD PLUS (Main drive)
500 GB Seagate 7200 RPM (Games)
500 GB Western Digital 7200 RPM (Virtual Machines)
PSU
CORSAIR TX Series TX650M 650W 80+ Gold Modular Power Supply
Case
CORSAIR CARBIDE SPEC-02 Mid-Tower Gaming Case, Red LED Fan
Cooling
220mm, two 120mm, and four 60mm fans
Keyboard
Wired Dell keyboard
Mouse
Wireless Logitech mouse
Internet Speed
250mb down, 30mb up
Antivirus
Panda Cloud Antivirus
Browser
Chrome-ish x64
Other Info
Your awesome for reading this.
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

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:

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
~~~
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 My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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 My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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 My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
You can use DelayedCuts from my page here:
Miles Ahead Software

to run a program as administrator at logon. DelayedCuts requires shortcuts to be added to the delay Gui. That way all program switches and options, such as Run As Administrator, are set in the shortcut. When you make a shortcut for the batch file make sure to right click and in Compatibility Tab, click Run As Administrator.

Once you add shortcuts and click Save it makes a shortcut to the DelayedLoad.exe program in the user's StartUp Folder. DelayedLoad.exe actually runs the delayed programs. It displays a small Gui that shows the icon, delay countdown, and name of the next program that will be run.
 

My Computer My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce

i can modify anything there not automatically though (also within the CMD...)
is there anything i can do?
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
You can use DelayedCuts from my page here:
Miles Ahead Software

to run a program as administrator at logon. DelayedCuts requires shortcuts to be added to the delay Gui. That way all program switches and options, such as Run As Administrator, are set in the shortcut. When you make a shortcut for the batch file make sure to right click and in Compatibility Tab, click Run As Administrator.

Once you add shortcuts and click Save it makes a shortcut to the DelayedLoad.exe program in the user's StartUp Folder. DelayedLoad.exe actually runs the delayed programs. It displays a small Gui that shows the icon, delay countdown, and name of the next program that will be run.

sounds nice, dont know if it could help me though,
does it work on safe mode?
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
sounds nice, dont know if it could help me though,
does it work on safe mode?
Sorry. I just tried it and it does not bypass the UAC prompt. I just had UAC slider set all the way down. I didn't write it to bypass UAC but to space out program loading, and also to load programs in order, at logon. Sorry for the "false alarm." :)
 

My Computer My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
sounds nice, dont know if it could help me though,
does it work on safe mode?
Sorry. I just tried it and it does not bypass the UAC prompt. I just had UAC slider set all the way down. I didn't write it to bypass UAC but to space out program loading, and also to load programs in order, at logon. Sorry for the "false alarm." :)

thanks anyway, at least youre trying :)
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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.
The post quoted above sounded simple enough.
It sounded like you...
...manually set msconfig to boot to the safe mode
...manually restart the computer
...want some process to automatically undo that "boot to safe mode" setting.


But then you tell me that your batch file modifies HKLM's Runonce key...
...so I'm back to being lost.


In you first post, you stated:
"im using the code : reg import *****.reg"

Can you post that reg file?
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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.
The post quoted above sounded simple enough.
It sounded like you...
...manually set msconfig to boot to the safe mode
...manually restart the computer
...want some process to automatically undo that "boot to safe mode" setting.


But then you tell me that your batch file modifies HKLM's Runonce key...
...so I'm back to being lost.


In you first post, you stated:
"im using the code : reg import *****.reg"

Can you post that reg file?

yes i can post it but why does it matter man? the reg file is a part of sequence that makes sure
the safemode option is unchecked.
if its too confusing i will try to explain again:
im trying to run a batch file with the only command of "reg import safemode.reg" and
i get the error, i cant find out why it gives me that error.
runonce is the only place one can startup a program from within safe mode.
i have posted here because im just trying to get the process shortened.
its just one simply code that i failed with.
i would like to not get back into msconfig via 'run' or whatever and not uncheck that option...

im sorry if its too much confusing, we can just let it go
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
I suggested that you do not have permissions to write to the area of the registry.

I then asked what area of the registry that you are modifying.

Your reply was LM's RunOnce.

I guess that I was not clear in asking my question...
...so I figured that the simplest way to get the info is to see the reg file.

What is the reg Value in the reg file?
 
Last edited:

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Back
Top