Similar issue seen here.
I am trying to run the following command from SSMS running in SQLCMD mode.
:r C:\dev\test scripts\sample.sql
But I get the following error:
A fatal scripting error occurred.
Incorrect syntax was encountered while parsing :r .
I have checked the file, the line endings are appropriate for the Windows machine, and the batch separator matches the settings. What else can I try to run this?