Avatar of Rick_Penney
Rick_Penney asked on

Batch File to clear run history silently

HI, i would like to be able to clear the run history silently and immediately  on XP machines by a batch file which is called from the start up folder.
I have created a batch file  which has the following entry:
regedit.exe /s c:\mruclear.reg
The reg file has the following entry:
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\Currentversion\Explorer\RunMRU]
This all works ok but will only take effect after you reboot the PC, is it possible to clear the RUN history immediately via a silent batch method?
Microsoft Legacy OSWindows XP

Avatar of undefined
Last Comment
Rick_Penney

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
dkumar82

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ACollyer

Both CCleaner and configuring by group policy still require a restart to take effect.

In fact, all the sources I can find are saying you must either restart the computer, kill and restart explorer, or click start --> shutdown --> cancel in order for the RunMRU changes to take effect.

The start --> shutdown solution does work, but I can't immediately see a way of doing this automatically.

If you use kill.exe in a batch file to kill off explorer.exe, then start it again, that does work but is by no means elegant.


regedit /s mruclear.reg
kill -f explorer.exe
start explorer.exe


See this KB article: http://support.microsoft.com/kb/142298
ACollyer

Get kill.exe (and some other useful apps as well) from here: http://www.mattkruse.com/utilities/
ASKER
Rick_Penney

Hi, many thanks to both of you for your suggestions.
dkumar82:   Group policy (user login )  works perfectly when i point it to the batch file which then silently runs the reg file.
i am more than happy with this solution, but just in case the process can be simplified even more, i have tried to add just the reg file in the login scripts and include the switch regedit.exe /s in the parameters but it doesn't run silently. is there a different parameter entry i could use?
many thanks again
rick
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
dkumar82

Add your registery settings on the same batch script, so that it would be invisible for end users.
dkumar82

Are u using regedit.exe /s ..try this also "REG ADD "
ASKER
Rick_Penney

Hi,  yes i am using regedit.exe /s in my .bat file.
i have tried reg add [-HKEY_CURRENT_USER\Software\Microsoft\Windows\Currentversion\Explorer\RunMRU]  in my .bat file
to eliminate having a seperate .reg file, but it doesnt work, it only works if i run the .reg file from the .bat file.
i am more than happy with this, i will just hide the two files away somewhere and run the bat file from the gp logon process.  thanks again for all your help, the reason behind all this is that we run a large workgroup and have to add policies locally via gpedit and i dont want users to see the utils we use to stop them meddling.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Rick_Penney

Many thanks again for all your help. Running the batch file from gp which in turn ran the reg file worked a treat.