Windows 7 How do I access the "SystemParametersInfo " function in a batch file?

TotallyAwesome

New Member
Joined
Jul 9, 2013
Messages
12
Hello,

I would like to use the following function "SystemParametersInfo" in a batch file on a Windows 7 machine. Is it in a DLL somewhere?
 


Solution
It appears that Rundll32's syntax says the usage should be:

rundll32.exe user32.dll,SystemParametersInfo Parm1 Parm2 Parm3

Have you tried
rundll32.exe user32.dll,SystemParametersInfo SPI_SETDESKWALLPAPER

You may have to find the defined value for SPI_SETDESKWALLPAPER and use that instead...
Hello,

Thanks for the response. I am migrating alot of computers from WIndows XP Pro to WIndows 7. Here is a example of one the things I am doing on the XP Pro machines

:std_wallpaper
echo "Start of Wallpaper change"
REG ADD "HKCU\Control Panel\Colors" /v Background /t REG_SZ /d "0 0 255" /f
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Stonehenge.bmp" /f
REM The following line refreshes the desktop.
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters
echo "Wallpaper change complete"
goto :eof

What I have discovered is that the following function/operation does not work in Windows 7
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters
 


Hello,
Thanks for telling where "SystemParametersInfo" is located. So I write some small test code to try it out.
 


Hello,

I tried the following code in a short bat file

echo "Start of Wallpaper change"
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "U:\Azul.bmp" /f
:: The following line refreshes the desktop.
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, SystemParametersInfo(SPI_SETDESKWALLPAPER)


I get a error dialog box that says

Error in user32.dll
Missing entry:SystemParametersInfo(SPI_SETDESKWALLPAPER)

It appear the the function does not exist in userdll.32
 


Hello,

I tried the following code in a short bat file

echo "Start of Wallpaper change"
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "U:\Azul.bmp" /f
:: The following line refreshes the desktop.
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, SystemParametersInfo(SPI_SETDESKWALLPAPER)


I get a error dialog box that says

Error in user32.dll
Missing entry:SystemParametersInfo(SPI_SETDESKWALLPAPER)

It appear the the function does not exist in userdll.32
At the end:

RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
 


Hello,

Thank you for the response to my request. I have made the changes you suggested and I am still getting the error dialogs. Here is the code segment

echo "Start of Wallpaper change"
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "U:\Azul.bmp" /f
REM The following line refreshes the desktop.
%SystemRoot%\System32\RUNDLL32.EXE user32.dll,SystemParametersInfo(SPI_SETDESKWALLPAPER)
%SystemRoot%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters,1,True

What am I missing here?
 


Remove:
%SystemRoot%\System32\RUNDLL32.EXE user32.dll,SystemParametersInfo(SPI_SETDESKWALLPAPER)

(Sorry, wrong answer... I tried your script. Back to the drawing board. Not sure what is wrong)
 


It appears this may have worked on previous versions of Windows but no longer.
 


I'm able to run the function like this:

Code:
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

Please not the EXACT spacing, as it did not work if I deleted spaces between commas, etc...
 


Thanks for the tip on the exact spacing, etc. that eliminated one of the error dialogs. Still getting a error dialog from

%SystemRoot%\System32\RUNDLL32.EXE user32.dll,SystemParametersInfo(SPI_SETDESKWALLPAPER)

This is a WIndows 7 computer and the UpdatePerUserSystemParamters worked fine on XP Pro. it no longer works on WIndows 7
 


When you say it doesn't work on 7 do you mean it gives you an error, or does not have the intended effect? It runs on my Windows 7 machine just fine, however I'm not trying to mess with the wallpaper to test if it actually functions.
 


Hello,

I should have clarified "it doesn't work". the desktop wallpaper does not change and I get a error dialog box. Soemthing happend with WIndows 7 that caused code not to work any more.
 


What does the error dialog say?
 


Hello,
Here is the text from the error Dialog box when I run the script

Error in user32.dll
Missing entry: SystemParametersInfo(SPI_SETDESKWALLPAPER)


The error message above implies that the "SystemParametersInfo" function is not contained in the user32.dll. Here is the code that calls the "SystemParametersInfo" function

%SystemRoot%\System32\RUNDLL32.EXE user32.dll,SystemParametersInfo(SPI_SETDESKWALLPAPER)


I hope this helps you help me figure out what is going on.
 


It appears that Rundll32's syntax says the usage should be:

rundll32.exe user32.dll,SystemParametersInfo Parm1 Parm2 Parm3

Have you tried
rundll32.exe user32.dll,SystemParametersInfo SPI_SETDESKWALLPAPER

You may have to find the defined value for SPI_SETDESKWALLPAPER and use that instead...
 


Solution
Back
Top