This batch worked when I wrote it and for almost 3 years after. Had to reinstall my laptop the other day, so I dug it out of burial, and now I cannot get it to work.
Code: Select all
@echo off
setlocal enabledelayedexpansion
set folder=C:\Users\Rooster\backgroundgirls\
set destination=c:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg
set count=0
set x=0
for /r "%folder%" %%G in (*.jpg) do (
echo %%G
set /a BACK_!count!=%%~G
set /a count+=1
echo count = !count!
)
set /a x="%random% %% count"
echo !x!
set chosen=!BACK_%x%!
echo chosen = %chosen%
copy /y “%chosen%” “%destination%” 1>nul
I am not quite sure what's failing here, except that %chosen% always equals zero (which means, no background is chosen) anyone got any ideas just from reading it? (PS Mind the unnecessary echos, using them to debug things)
System info:
Gateway NV55S02U
AMD A6-3400 APU w/ Integrated Radeon HD 6520M
Windows 7 Home Premium SP1
Edit:: Marked as solved