Question

I need to make a batch file that changes the wallpaper to a picture that is in the same location as the bat file I currently have this code:

reg add "HKCU\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d c:\images\wallpaper.bmp

the problem with this is that it the pictures need to be in the folder c:\images\ and I need it to be in the same place as the bat file. does any one know how I could do it.

Was it helpful?

Solution

You can use %~dp0wallpaper.bmp

%~dp0 returns the full path of the batch file that is being executed with a backslash at end.

You probably might want to enclose the filename in double quotes in case the batch file's directory contains spaces: "%~dp0wallpaper.bmp"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top