msdemich Posted July 21, 2008 Share Posted July 21, 2008 After a fresh XP install and the destop loads for the first time, I run a batch file to make some final registry tweaks, clean up shortcuts, and reboot one last time. Once this script is complete, I check that the shortcuts (Internet Explorer.lnk, Outlook Express.lnk, etc.) are deleted like they are supposed to then I check the registry to be sure the new settings are actually there. But after reboot, the shortcuts are back and the registry has reverted to the old settings again. If I run this script and reboot a second time, all the settings will stick. But they never stick after the first boot. This drove me crazy trying to find out why the right settings wouldn't stick. It wasn't until I started calling the script from HKCU..\RunOnce that I concluded that the registry simply was not saving the changes. Using Runonce, the script would run, reboot, then run AGAIN, and reboot. After the second reboot it would not run again. On first boot to desktop, Windows would delete the RunOnce entry like it was supposed to do, which I would verify with regedit every time. But when I reboot the, RunOnce entry would be there again. So -only on first complete boot and shutdown- windows would revert back to the same HKCU..\RunOnce setting, even after it ran it. Observed on multiple installations of XP Pro OEM and XP Home OEM.Somehow I think this behavior is by design from Microsoft, but I've searched for it and haven't find any documentation. The registry may be locked somehow on first boot (after GuiRunOnce) and not be editable until a second boot, but the shortcuts? Why would windows put those deleted shortcuts back after restart from desktop? Any other files copied on first complete boot seem to stay in their place.As a workaround, I've stopped using RunOnce and I'm running my script (1stBoot.cmd) from %AllUsersProfile%\Start Menu\Programs\Startup that will set the computer to automaticly restart, delete itself from the %AllUsersProfile%..\Startup folder, and set a second script (2ndBoot.cmd) to run on next boot via %AllUsersProfile%..\Startup. So after the first boot to desktop, 1stBoot.cmd will just set 2ndBoot.cmd to autorun and reboot. 2ndBoot.cmd does all the real work with registry settings and shortcuts on the second boot.If anyone knows why the registry settings don't take on the first complete boot to desktop, (and why the shortcuts come back) please let me know. Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now