Since you use SQL Server 2005, Would recommend using SQLCMD instead of the deprecated osql..
http://msdn.microsoft.com/en-us/library/ms162773.aspx>> Incorrect syntax near '''.
Seems like an syntax error in your query1.sql file..
Posting the contents would help us to fix it out..