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
ASKER CERTIFIED SOLUTION
Avatar of dkumar82
dkumar82
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of ACollyer
ACollyer
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of ACollyer
ACollyer
Flag of United Kingdom of Great Britain and Northern Ireland image

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

ASKER

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
Avatar of dkumar82
dkumar82
Flag of India image

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

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

ASKER

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.
Avatar of Rick_Penney
Rick_Penney

ASKER

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

Microsoft Windows XP is the sixth release of the NT series of operating systems, and was the first to be marketed in a variety of editions: XP Home and XP Professional, designed for business and power users. The advanced features in XP Professional are generally disabled in Home Edition, but are there and can be activated. There were two 64-bit editions, an embedded edition and a tablet edition.

119K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo