Welcome to WebmasterWorld Guest from 54.204.210.197

Forum Moderators: open

Message Too Old, No Replies

Sql Wildcards In Batch File

%whatever% isn't passing when the batch is ran.

   
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
3:56 pm on Mar 31, 2011 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
5:46 pm on Mar 31, 2011 (gmt 0)



Nope.
Thanks for the thought, though.
JJ
6:20 pm on Mar 31, 2011 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Try 2 percents characters?
[support.microsoft.com...]

And here is the full Command shell overview [microsoft.com].
7:13 pm on Mar 31, 2011 (gmt 0)



Whoohoo!
That works, perfectly.
Thanks...
JJ