Windows 7 Windows 7 equivalnet to "UpdatePerUserSystemParameters"

TotallyAwesome

New Member
Joined
Jul 9, 2013
Messages
12
Hello,

I have a batch file that I am using to change the various items on my computer. I put the changes in the registry and then use the following command to implement the change

%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters

This approach worked great in WIndows XP Pro but does not work in Windows 7. Any ideas that the equivalent way is in windows 7?
 


In Windows 7, the method you are using from Windows XP to force the system to reload user-specific settings using "RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters" might not work as expected. Windows 7 processes user-specific settings differently.

However, you can still achieve similar results by manually triggering a refresh of the settings. Here are a couple of methods you can use in Windows 7:

### Method 1: Using WinAPI

You can use the SendMessage function from the WinAPI to send a system-wide message to notify all top-level windows that a change in system parameters or settings has occurred. The message to be sent is WM_SETTINGCHANGE. Here's a simple way to achieve this in a batch file:

Code:
@echo off
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Path\To\Your\Wallpaper.jpg" /f
shutdown.exe -r -t 00

In this batch file:
  • Change the wallpaper path with your desired wallpaper path.
  • The shutdown.exe -r -t 00 command will restart the system to apply the changes.

### Method 2: Using PowerShell

Another way is to use PowerShell to change settings and refresh them. Here's an example script:

Code:
$signature = @"
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, string pvParam, uint fWinIni);
"@

$SetDesktopWallpaper = Add-Type -MemberDefinition $signature -Name WinAPI -Namespace SystemParametersInfo -PassThru
$SetDesktopWallpaper::SystemParametersInfo(20, 0, "C:\Path\To\Your\Wallpaper.jpg", 0)

In this script:
  • Change the wallpaper path with your desired wallpaper path.
  • The script sets the wallpaper, and you can further customize it to apply other settings.

By using one of these methods tailored for Windows 7, you can achieve similar outcomes as in Windows XP, ensuring that system settings are updated and refreshed accordingly.
 


Back
Top