Archive: escaping quotes


escaping quotes
Hi - I'm having issues escaping quotes in my script.

I have a fairly complicated string which needs the quotes escaped at some point.

MessageBox MB_OK "$R1\Binn\osql.exe -Uxxx -Pxxx -S $R2\bluezinc -Q $5 RESTORE DATABASE tmBase FROM DISK ='C:\Train.bak' WITH PASSWORD ='xxx', REPLACE, RECOVERY, MOVE 'tmTrain_dat' TO '$R3\Data\tmBase.mdf', MOVE 'tmTrain_log' TO '$R3\Data\tmBaseLog.ldf'$5  -o $4\patches.log"


I have marked as $5, the point where i need the escaped (double) quotes to go.

I hope someone might be able to help or suggest a better alternative,
thanks, chris

I think you need the $/" as an escaped "

so from your example

MessageBox MB_OK "$R1\Binn\osql.exe -Uxxx -Pxxx -S $R2\bluezinc -Q $\"RESTORE DATABASE tmBase FROM DISK ='C:\Train.bak' WITH PASSWORD ='xxx', REPLACE, RECOVERY, MOVE 'tmTrain_dat' TO '$R3\Data\tmBase.mdf', MOVE 'tmTrain_log' TO '$R3\Data\tmBaseLog.ldf'$\"


thanks sfranklin - i had been trying that for ages but it wasn't working - think my SciTe syntax highlighting wasn't helping.... you did miss a quote of the end, but I am abundantly happy :).

Many thanks again, chris


not a problem, though your right i did miss a quote