I have created a couple of batch files with Notepad to further this functionality, patterned after a classic DOS technique.
- "RandomEdgeWallpaper.bat" randomly changes the background of Edge from a folder of images.
- "ResetEdgeWallpaper.bat" restores your single favorite image to be your Edge background.
Running the first batch file sets your Edge background to a random image (in this example, the file will be type
jpg). Running the second file restores the Edge background to your favorite image (a 'default' of sorts).
1) Carefully type the scripts as shown. Save to a folder of your choice.
2) Modify yellow areas as needed.
3) Enjoy
Tip: To have the batch file run without opening a large DOS window, create a shortcut to the batch file, then set its properties to Run Minimized.
RandomEdgeWallpaper.bat
Code:
@echo off & setlocal
:: ---------------------
::
:: Adaptation of DOS script to select a random file from a folder, and copy it to a destination
::
:: Doug Sharp - 2015 for surfaceforums.net
::
:: Specify paths from the user folder downwards.
:: Example: c:\Users\Doug\Onedrive\ is "\Onedrive\"
::
:: ---------------------
set "ImageDir=\OneDrive\Pictures\Wallpaper Surface\"
set "HomePageDir=\OneDrive\HomePage\"
set SearchFor=*.jpg
::
set "Here=%USERPROFILE%%ImageDir%"
set "There=%USERPROFILE%%HomePageDir%"
@set /a "rdm=%random%"
set /a "rdm=%random%"
::Push to your path.
pushd "%Here%"
::Count all files in your path.
set /a "counter=0"
for /f "delims=" %%i in ('dir %SearchFor% /b ^|find "."') do call :sub1
::This function gives a value from 1 to upper bound of files
set /a "rdNum=(%rdm%*%counter%/32767)+1"
::Select a random file
set /a "counter=0"
for /f "delims=" %%i in ('dir %SearchFor% /b ^|find "."') do set "fileName=%%i" &call :sub2
::Pop back from your path.
popd "%Here%"
goto :eof
:: end of main
:: start of sub1
:sub1
::For each found file set counter + 1.
set /a "counter+=1"
goto :eof
:: end of sub1
:: start of sub2
:sub2
::1st: count again,
::2nd: if counted number equals random number then copy the file.
set /a "counter+=1"
if %counter%==%rdNum% copy /b/v/y "%Here%%fileName%" "%There%MyHomePageBackground.jpg"
goto :eof
exit
ResetEdgeWallpaper.bat
Code:
rem @echo off
::
:: ---------------------
set HomePageDir=\OneDrive\HomePage\
set FavoriteImage=MyHomePageBackground_Original.jpg
::
set Here=%USERPROFILE%%HomePageDir%%FavoriteImage%
set There=%USERPROFILE%%HomePageDir%MyHomePageBackground.jpg
::
copy /b/v/y "%Here%" "%There%"
exit