Command Line scripting with a space in the DB name
Anyway, what we have is a script that will run each night and create snapshots of our databases. The following works fine for us (called from a vbscript using the objshell.run method):
cmd /C "C:\Program Files\Red Gate\SQL Bundle 5\SQLCompare.exe" /database1:db_name /makesnapshot:\\server\share\snapshots\db_name.snp
But we've also got some databases with a space in their name. When we try to run the command:
cmd /C "C:\Program Files\Red Gate\SQL Bundle 5\SQLCompare.exe" /database1:db name /makesnapshot:\\server\share\snapshots\db name.snp
The script fails because it's trying to connect to a database named db. Is there a "wrapper" I can use like [db name]?
We've tried various other options as far as quoting the parameters passed into the sqlcompare.exe program and either the cmd command fails or the /database: parameter only interprets the db name to the space.