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: auto-merge .reg @boot


13 Jul 2010   #1

W7 Pro x86
 
 
auto-merge .reg @boot

Hi,
Is it possible to have my Windows 7 Pro x64 automatically merge a .reg file into the registry at every boot (or, on every login if thats easier.. I only use one account so far).
(Its supposed to clear a bunch of history and MRU entries and those sort of things).

In XP i used to do it via .bat file, but there has to be a more elegant solution, I figure

thanks in advance

My System SpecsSystem Spec
.

13 Jul 2010   #2

Windows 7 Ultimate 64 bit
 
 

Hi wahnsinn,

I too would use a batch file and I'd s also use the windows scheduler with triggers to set it so that it runs automatically.

I can't think of any "more elegant" way.

- Timo
My System SpecsSystem Spec
13 Jul 2010   #3

Windows 8.1 Pro RTM x64
 
 

Hi wahnsinn,

If the batch file works, then there is no reason to change it.

What you can do is to arrange for it to execute automatically and, instead of using the Task Scheduler, I would suggest the following. It involves editing the Registry.

Log onto the account(s) that you wish execute the batch file on and open the Registry Editor. Next, browse to the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

In the right-hand panel, right- click and choose New > String Value. Name it Batch (or whatever you want, this doesn't matter but it is helpful to have meaningful names). Next, right-click on the new entry and choose Modify... (alternatively, double-click it). Enter the following code:

C:\<Path to batch file>\Batch.bat
My System SpecsSystem Spec
.


13 Jul 2010   #4

W7 Pro x86
 
 

Thanks for your answers.
I have not actually tried the batch file on Windows 7, but am confident it would work.
But I still feel this is a quite clumsy way of doing it, and would prefer a solution that doesnt feel so much like a work-around.

In my search for another solution I came upon the idea of using a logon script..
I know in theory how to set one up - cant script myself though, and wouldnt know how to make it merge a .reg either..
but that, I think, would be a good, elegant, solution .. maybe anyone here knows how to do that..?
My System SpecsSystem Spec
14 Jul 2010   #5

Windows 7 Ultimate 64 bit
 
 

Hi Wahnsinn,

Let me point you in the right direction and then you can let me know if you get stuck and I'll elaborate.

1. Create your script in vbs or Powershell.
2. Open gpedit.msc (by typing it into RUN or SEARCH and pressing ENTER)
3. Navigate to USER CONFIGURATION | WINDOWS SETTINGS | SCRIPTS | LOGON
4. Double click on LOGON to bring up the properties and link it to your script.

I'm yet to try this on Windows 7 on a stand alone install (I've set up many logon scripts via DC's), so I look forward to hearing how you go with this one.

Good Luck

Timo


Attached Thumbnails
auto-merge .reg @boot-logon.jpg  
My System SpecsSystem Spec
25 Jul 2010   #6

W7 Pro x86
 
 

Sorry for not responding sooner, I have in fact not had any time to investigate this matter any further so far!

Thanks for your response, TimStitt, but, as I pointed out earlier, I already knew HOW to add a script basically, my problem lies in your step 1. "Create your script ..."

Also, coming back to the original "batch file" thing, could it be that Windows accepts batch files as logon scripts?
I'll definitely need to check that out at some point.. that obviously would be the easiest way, and if thats what you were trying to tell me in your first post, I apologize for misunderstanding
My System SpecsSystem Spec
25 Jul 2010   #7

Windows 7 Ultimate 64 bit
 
 

Hi wahnsinn,

No problem of the delay in getting back. I get a notification and am happy to take it up when you're available.

However, I admit to be there being some confusion as to what you require. SO I will give you a lot of information and a few guesses here in an effort to hit the right spot!

Batch (CMD) Scripting
If you already have a batch file that imports a registry entry. Just add this as your logon script in gpedit. To answer your question, as far as I am aware 'Yes' windows accepts batch files (if you check in the adding s startup script area you'll see that the file type is "all file types"). You can easily verify this by adding your batch file, rebooting and letting us know. If this doesn't work then task scheduler would be the best move forward. When you set this up via gpedit, ensure that SYSTEM has read permissions on the file and don;t store the batch file in thes directory as this will make windows prompt for admin rights to run it.

If you wish to run a *.reg file from inside a batch, or even create the regfile during the batch file running, then we need to consider checking the registry and file permissions first, which is no big problem, but let me know and we'll take it from there.

Powershell (PS) and Visual Basic (VB) Scripting [VBS]
If you are wishing to learn another scripting language (such as VB or PS) then please say exactly that, post your batch file up so that I can see what it does (feel free to PM me if it's a file that you want to keep private) and we can talk about the next steps. However using powershell or VB is neither more or less elegant than a command script (for most functions).

Lastly, if we're not on the same page yet , please break it down to baby steps. Here's an example, feel free to edit it or write your own.

Enviroment
1. I have this script xxxxxx
2. It works in XP when added to the start menu folder
3. I am using this script in Windows 7 Ultimate 64bit and Windows 7 HP 32bit
Job Scope
I would like the script to work in the above environment with the following requirements:
1. Low installation time
2. work Automatically
3. Low maintenance
Questions
1. Is this possible?
2. Is there another method (a better method?) that I can use to configure this scenario?


-Timo
My System SpecsSystem Spec
03 Aug 2010   #8

W7 Pro x86
 
 

Quote   Quote: Originally Posted by TimStitt View Post
If you already have a batch file that imports a registry entry. Just add this as your logon script in gpedit. To answer your question, as far as I am aware 'Yes' windows accepts batch files (if you check in the adding s startup script area you'll see that the file type is "all file types"). You can easily verify this by adding your batch file, rebooting and letting us know.
Thanks Tim, that works like a charm.

Quote   Quote: Originally Posted by TimStitt View Post
When you set this up via gpedit, ensure that SYSTEM has read permissions on the file and don;t store the batch file in thes directory as this will make windows prompt for admin rights to run it.

If you wish to run a *.reg file from inside a batch, or even create the regfile during the batch file running, then we need to consider checking the registry and file permissions first, which is no big problem, but let me know and we'll take it from there.
Both of these things turned out to be no problem on my system, i have the .bat stored in C:\Windows\System32\GroupPolicy\User\Scripts\Logon , the permissions of which seem to be quite heavily restricted (for example, I cannot edit the file with a text editor directly), but it runs without a hitch from that location nonetheless.

I also used a little trick I picked up on Batch files - Use REGEDIT to add, read or delete registry values, which he calls "Self-contained registry scripts":

Code:
 
registry.bat:
 
REGEDIT4
; @ECHO OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT
[HKEY_CURRENT_USER\Software\Microsoft\etc]
"etc"=etcetera
..which allows for the .bat file to include the information otherwise included in the .reg


thanks again for all your help, this thread can be closed if that is the normal policy on here.
My System SpecsSystem Spec
09 Aug 2010   #9

Windows 7 Ultimate 64 bit
 
 

Quote   Quote: Originally Posted by wahnsinn View Post
Quote   Quote: Originally Posted by TimStitt View Post
If you already have a batch file that imports a registry entry. Just add this as your logon script in gpedit. To answer your question, as far as I am aware 'Yes' windows accepts batch files (if you check in the adding s startup script area you'll see that the file type is "all file types"). You can easily verify this by adding your batch file, rebooting and letting us know.
Thanks Tim, that works like a charm.

Quote   Quote: Originally Posted by TimStitt View Post
When you set this up via gpedit, ensure that SYSTEM has read permissions on the file and don;t store the batch file in thes directory as this will make windows prompt for admin rights to run it.

If you wish to run a *.reg file from inside a batch, or even create the regfile during the batch file running, then we need to consider checking the registry and file permissions first, which is no big problem, but let me know and we'll take it from there.
Both of these things turned out to be no problem on my system, i have the .bat stored in C:\Windows\System32\GroupPolicy\User\Scripts\Logon , the permissions of which seem to be quite heavily restricted (for example, I cannot edit the file with a text editor directly), but it runs without a hitch from that location nonetheless.

I also used a little trick I picked up on Batch files - Use REGEDIT to add, read or delete registry values, which he calls "Self-contained registry scripts":

Code:
 
registry.bat:
 
REGEDIT4
; @ECHO OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT
[HKEY_CURRENT_USER\Software\Microsoft\etc]
"etc"=etcetera
..which allows for the .bat file to include the information otherwise included in the .reg


thanks again for all your help, this thread can be closed if that is the normal policy on here.
Your welcome mate and thanks for the additional info.

BTW - If you can;t edit the batch file normally in that location. Open notepad with admin privileges and then open the bat file from notepad. This usually works.

Cheers

Timo
My System SpecsSystem Spec
Reply

 auto-merge .reg @boot




Thread Tools



Similar help and support threads for2: auto-merge .reg @boot
Thread Forum
Merge boot and system partitions General Discussion
Solved Problem with Boot Manager - will not auto boot from HD Installation & Setup
PC Auto boot is not working on normal HDD boot mode General Discussion
how to auto boot to a program General Discussion
Solved Boot and System Partition Merge Hardware & Devices
Merge or create partition & Dual Boot Hardware & Devices
Computer Auto Shut off and won't boot 7 BSOD Help and Support

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 03:05 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33