Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Import Reg File: cmd works - Reg\Regedit w/bat file doesn't work?

26 Oct 2017   #1
KapaKai5O

Win 7 Pro 32bit
 
 
Import Reg File: cmd works - Reg\Regedit w/bat file doesn't work?

This is embarrassing but I've spent so many hours on it I feel I have no choice.
I'm not real keen with Win 7 yet and I've done this with earlier os's without this problem.
Can't figure out why it's not working here, and I see many others having similar questions.
OS = Win7 Pro 32 bit.

I'm used to keyboard\cmd prompt so it's not an issue for me, but I'm putting together a system
for a friend who isn't that 'cmd prompt savvy'.

I need to create simple batch files for deleting and importing reg value (hklm\software\xxxx\run).
The program I'm trying to manage has no way to prevent auto running within it's gui
so I have allow the user to do this manually.
It's a FW so it's important to be able to manage it for troubleshooting etc.
It can be temporarily disabled, but it's important to prevent it from auto running as well.

When I run either 'reg.exe import autorun.reg', noautorun.reg' OR 'regedit /s autorun.reg' etc.,
via command line from the folder the reg files are in, it works perfectly every time.
But no matter how I create the bat files, they run with no prompt, no error(s) and do nothing.
Even when run as admin.

Can someone please explain what I am missing here?
I've read in a very dated thread here where someone claimed it worked by adding:
'rundll32.exe USER32.DLL, UpdatePerUserSysetmParameters ,1 ,True'
but I don't recall ever having to do this with a simple reg file import or value deletion.

I realize that Mark R's Autoruns would do the trick, but I need it to be a one click solution,
so it's very simple for user.

Thanks very much for any help on this!


My System SpecsSystem Spec
.
27 Oct 2017   #2
samuria

win 8 32 bit
 
 

You should use the cmd regedit /s autorun.reg.

Look a winpatrol that stops any new software adding to start it ask for permission to let it start it does so much more blocks virus from starting and lets you edit start very simply
My System SpecsSystem Spec
27 Oct 2017   #3
KapaKai5O

Win 7 Pro 32bit
 
 

Quote   Quote: Originally Posted by samuria View Post
You should use the cmd regedit /s autorun.reg.
Thanks for the response.
Are you implying that it's not possible to setup a batch file for this simple purpose with W7?
As I wrote above, user is not wanting to type in cmd prompt.

If that's the case, I'll have no choice but to create direct shortcuts to the reg files.
And user will have to click ok on the warning every time reg file runs. I wanted to avoid that route.
Quote:
Look a winpatrol that stops any new software adding to start it ask for permission to let it start it does so much more blocks virus from starting and lets you edit start very simply
?????
My System SpecsSystem Spec
.

27 Oct 2017   #4
samuria

win 8 32 bit
 
 

I gave you the code for batch file regedit /s autorun.reg
My System SpecsSystem Spec
27 Oct 2017   #5
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

I have no problem running regedit /s path_to_something.reg from a batch file.

You have a strange issue, it seems.

Quote:
I see many others having similar questions.
Where? Do you have links?
My System SpecsSystem Spec
27 Oct 2017   #6
TechnoMage2016

Windows 7 Ultimate, SP1, x86
 
 

If I'm going to add something to, or edit, my registry, I use a .reg script and NOT a batch file.

That's much less problematical.

Example of a Windows 7 registry tweak: file name, "Win-7 Performance Tweak.reg"

Windows Registry Editor Version 5.00
; Shorten shutdown time. Time is in Milliseconds.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]
"WaitToKillServiceTimeout"="1000"

; Load the Kernel into RAM on boot, for faster running.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"DisablePagingExecutive"="1"
"LargeSystemCache"="1"


I have a whole library of such .reg scripts, that I use when setting up a new PC or tuning up an old one.

Cheers Mates!
TechnoMage
My System SpecsSystem Spec
27 Oct 2017   #7
KapaKai5O

Win 7 Pro 32bit
 
 

Quote   Quote: Originally Posted by samuria View Post
I gave you the code for batch file regedit /s autorun.reg
Sorry, didn't understand. It's because that's exactly what I've been trying to do.
My System SpecsSystem Spec
27 Oct 2017   #8
KapaKai5O

Win 7 Pro 32bit
 
 
Searching Reveals Plenty of People

Quote   Quote: Originally Posted by SIW2 View Post
I have no problem running regedit /s path_to_something.reg from a batch file.
Is it possible you could post it?
Quote:
You have a strange issue, it seems. Where? Do you have links?
Too many to post. I searched and found numerous references on stack overflow and others.
My System SpecsSystem Spec
27 Oct 2017   #9
KapaKai5O

Win 7 Pro 32bit
 
 
Could You Possibly Post One?

Quote   Quote: Originally Posted by TechnoMage2016 View Post
If I'm going to add something to, or edit, my registry, I use a .reg script and NOT a batch file.

That's much less problematical.

Example of a Windows 7 registry tweak: file name, "Win-7 Performance Tweak.reg"

Windows Registry Editor Version 5.00
; Shorten shutdown time. Time is in Milliseconds.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]
"WaitToKillServiceTimeout"="1000"

; Load the Kernel into RAM on boot, for faster running.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"DisablePagingExecutive"="1"
"LargeSystemCache"="1"


I have a whole library of such .reg scripts, that I use when setting up a new PC or tuning up an old one.

Cheers Mates!
TechnoMage
Could you possibly post ones to simply add & remove program from:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ?

I can create simple .reg files for this but again, user will need to ok for permission to run.
Wouldn't scripts be the same? I'm trying to avoid user having to ok to run it.
Sorry if I am not getting this, it's been quite awhile.

Can't thank you enough for your help!
My System SpecsSystem Spec
27 Oct 2017   #10
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

From a huge .cmd file, here is a relevant section


Code:
@echo off
SET TP=%~dp0
SET TP=%TP:~0,-1%
cd /d "%TP%"
mode con lines=40 cols=100
color 5f

 reg.exe import "BIN\REG64\VC90x64.reg" >nul

pause
My System SpecsSystem Spec
Reply

 Import Reg File: cmd works - Reg\Regedit w/bat file doesn't work?




Thread Tools




Similar help and support threads
Thread Forum
.bat file doesn't work without admin permissions
Hi All, I have bitlocker and have found a guide to allowing me to right click on the drive to relock it; it is done via a .bat file. https://www.sevenforums.com/tutorials/90815-bitlocker-lock-unlocked-drive.html Unfortunately this .bat file will only run if I right click on it and 'run as...
General Discussion
Search doesn't work for numbers in contents of a file
I'm having no luck figuring this out. So I hope you guys will be able to help. The search function doesn't work for me when I search for partial numeric strings. I created a text file and put 123456789 inside it. Search only seems to find the text file when I do a search for the exact...
General Discussion
regedit default uninstallstring file name
Hello, everyone I need some help. Could someone give me the default value data name for "Unistall String" I clicked on it while looking (just looking not trying changing anything) and renamed it. Thank you in advance. I used system restore. How do I delete this post?
General Discussion
Open file and Save as doesn't work
Hi there, I have the same problem already reported in the forum:File|Open and File|Save As does not work at all for any application. Basically nothing happens, the dialog never opens an in my mail is not possible to upload files.. nothing, the common dialog to handle files never opens. I tried to...
General Discussion
How can I replace my W7 registry file without using regedit ?
Having an issue with my system and trying to restore to an earlier state...but both System Restore and Regedit - import are giving me errors ? Here's a couple screen shots that show the main error messages attached On the registry...I have a full backup of my registry prior to the changes I...
Performance & Maintenance


Our Sites

Site Links

About Us

Find 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 22:11.
Twitter Facebook Google+