To Backup:
sqlcmd -S.\SQLExpress
1> BACKUP DATABASE dbName TO DISK = 'path'
2> GO
An alternative, single-line backup command:
sqlcmd -S.\SQLExpress -Q"BACKUP DATABASE dbName TO DISK = 'path'"
(Note that you must enclose the path within quotes)
To Restore:
sqlcmd -S.\SQLExpress
1> RESTORE DATABASE dbName FROM DISK = 'path'
2> GO
An alternative, single-line restore command:
sqlcmd -S.\SQLExpress -Q "BACKUP DATABASE dbName FROM DISK = 'path' "
(Note that you must enclose the path within quotes)
Replacing <dbname></dbname>with the name of the database you wish to backup and
<path></path>with the path for the backupfile. For a default myTV installation dbName would be myTV and the path could be C:\Program Files\Microsoft SQL Server\bak\myTV.bak.
Daelic's Note: I found my backup path here: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup. Also, you will get an error and the backup will fail if you attempt to backup anywhere other than the pre-defined MSSQL backup location.