I have foo.sql as:
print 'foo=$(foo)'
Then I have in foo.cmd the following shell script:
sqlcmd -i foo.sql -v foo="c:\path"
Running foo.cmd prints:
foo=\path
how do I escape the "c:"? Is dos-shell eating it, or is it sqlcmd?
I have foo.sql as:
print 'foo=$(foo)'
Then I have in foo.cmd the following shell script:
sqlcmd -i foo.sql -v foo="c:\path"
Running foo.cmd prints:
foo=\path
how do I escape the "c:"? Is dos-shell eating it, or is it sqlcmd?
Escape the backslash,
sqlcmd -i foo.sql -v foo="c:\\path"
It's actually your shell eating the \
cmd's argument delimiters include the equal sign. I've seen in other cases (such as bjam.exe) that the entire parameter sequence has to be quoted to work properly.
Try this:
sqlcmd -i foo.sql -v "foo=c:\path"
If it still strips the "c:" portion, I'd focus on sqlcmd. I don't personally have it installed to test with. This is based solely on experience with similar situations.
OK, my mistake. the above does work.
What i did wrong was doing: sqlcmd -i foo.sql -v foo='c:\path'
(single quote, since I tried to pass them as ' ' sql string) that won't work. it will chop the c: