• You have a few problems. First if there is more than one .bak file, you have no guarantee of which one your script will find.

    Second, you can't include a variable with a string without any operator. What you probably want is something more like this, assuming you fix the first item.

    select @filename = 'c:\DB_Backups\' + SUBSTRING(line,37,100) FROM dirList where line like '%.bak'

    restore database chillistore2

    from disk = @filename