title: Best script to restore multiple databases with SQL Server 2012?
body: <p>I have to restore around 60 SQL databases of different sizes. I googled to find a script to restore all databases after each other , just picking it 1 by 1 from my folder. I was not that successful, probably because I am quite new to SQL etc.</p>
  
  <p>It can be either done in powershell or sql command line, what I found for now was something like this:</p>
  
  <pre><code>RESTORE DATABASE [db1] FROM  DISK = N'C:\folder\db1.bak' WITH  FILE = 1,  NOUNLOAD,  STATS = 10
  GO
  RESTORE DATABASE [db2] FROM  DISK = N'C:\folder\db2.bak' WITH  FILE = 1,  NOUNLOAD,  STATS = 10
  GO
  </code></pre>
  
  <p>So what I would do is get the filenames from a certain folder and replace "db1.bak" etc. with the names I just picked from my folder and then run the script.</p>
  
  <p>I know that there must be a smarter way, or is it maybe possible to "load" many .bak files into SSMS so the program will run them after each other?</p>