How to use the REPLACE parameter with a command line restore.
Example script using the -WREPLACE parameter:
C:\Program Files\Imceda\LiteSpeed\SQL Server\Engine>sqllitespeed.exe -Rdatabase -T
-Dsub_lsl -FC:\backups\sub_lsl200801091539LiteSpeed_Full.BKP
-SAUS206155 -WREPLACE -W"MOVE 'sub_lsl'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\sub_lsl_Data.mdf'"
-W"MOVE 'sub_lsl_log'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\sub_lsl_Log.ldf'"
Results:
Processed 2280 pages for database 'sub_lsl', file 'sub_lsl' on file 1.
Processed 2 pages for database 'sub_lsl', file 'sub_lsl_log' on file 1.
RESTORE DATABASE successfully processed 2282 pages in 6.451 seconds (2.897 MB/sec).
CPU Seconds: 0.42
Environment: Intel(R) Pentium(R) 4 CPU 3.20GHz
CPUs: 2 logical, 1 core(s), 1 physical processors(s).