Just found this useful command over here. You can restore a db backup via the command:
RESTORE DATABASE MyDB
FROM DISK = 'C:\Data\MyDB.bak'
WITH MOVE 'logicalname_data' TO 'C:\Data\MyDB.mdf', MOVE 'logicalname_Log' TO 'C:\Data\MyDB.LDF'
To find out what the logicalname
is one can execute the following:
RESTORE FILELISTONLY
FROM DISK = 'C:\Data\MyDB.bak'