Automatically responding yes to forfiles
You could try adding in a /Q /S, though be aware that this may not in fact do what you really want it to:
/Q Quiet mode, do not ask if ok to delete on global wildcard
/S Delete specified files from all subdirectories
E:\forfiles -p "H:\SHARED\Scans" -s -m . -d -7 -c "cmd /c del /Q /S @path"
You are probably better off either using CSCRIPT (with your choice of VBScript or JScript) or PowerShell. Check out this answer from StackOverflow: https://stackoverflow.com/questions/1575493/how-to-delete-empty-subfolders-with-powershell
Here is some vbscript to accomplish a similar task:
Dim fso, folder, folders
Set fso = CreateObject("Scripting.FileSystemObject")
Set parent = fso.GetFolder("H:\SHARED\Scans")
Set folders = parent.SubFolders
' delete any folder older than 7 days
For Each folder in folders
If Abs(DateDiff("d",Date, folder.DateCreated)) > 7 Then
folder.Delete(True) 'force delete
End If
Next