| Sql Wildcards In Batch File %whatever% isn't passing when the batch is ran. |
doubleJ

msg:4290167 | 2:53 pm on Mar 31, 2011 (gmt 0) | I have a sql statement that works well when run from the command line. It returns 60 records (or whatever the amount at that time is).
"C:\Program Files (x86)\Log Parser 2.2\LogParser.exe" "SELECT COUNT(cs-uri-stem) FROM c:\inetpub\logs\logfiles\w3svc1\u_ex1104*.log WHERE sc-status=200 AND cs-uri-stem LIKE '%music%.mp3' AND sc-bytes >= 1377915" -i:W3C -o:W3C
If I put it in a .bat and run it, though, it returns 0 records. I think it's because the batch file is expecting %music% to be a variable and not a wildcard. I tried *music* but it returned 0 records, too. Is there a way to escape the % or use a different character, so both the batch and statement work? JJ
|
coopster

msg:4290209 | 3:56 pm on Mar 31, 2011 (gmt 0) | Try the escape from shell backslash (\) in front of the percent signs. I'm not a Windows pro so I am uncertain if that will work, but it's worth a shot.
|
doubleJ

msg:4290259 | 5:46 pm on Mar 31, 2011 (gmt 0) | Nope. Thanks for the thought, though. JJ
|
coopster

msg:4290282 | 6:20 pm on Mar 31, 2011 (gmt 0) | Try 2 percents characters? [support.microsoft.com...] And here is the full Command shell overview [microsoft.com].
|
doubleJ

msg:4290305 | 7:13 pm on Mar 31, 2011 (gmt 0) | Whoohoo! That works, perfectly. Thanks... JJ
|
|
|