Ken Allen wrote:
> Gaius Bonus wrote:
>> fiNa=mgmt.ExecQuery("SELECT * FROM CIM_DataFile WHERE Name =
>> 'c:\\test.txt'")
>> fiNa.each {|fn| puts fn.FileSize.to_s}
>>
>> I do not get any error message but also no output. So I think I do
>> something wrong with the wmi handling. I messed arround the whole day
>> and now I run out of ideas. It would be great if you could help me.
>> Thanks in advance,
>> bye
>>
>>   
> \ is a control character in both in WQL and ruby so you need to escape
> the slashes in the query twice:
> 
> fiNa=mgmt.ExecQuery("SELECT * FROM CIM_DataFile WHERE Name =
> 'c:\\\\test.txt'")
> 
> Also, the reason you weren't getting an error message about this seems
> to be related to WMI often being asynchronous. If you had tried
> fiNa.Count
> it would have thrown an 80041017 error - a syntax error.
> 
> BTW I know nothing of WMI, I was just bored, curious, and feeling
> generous so I basically did the googling for you :)
> 
> Ken

Hello Ken,
thanks for the help, it was the hint. As I wrote I'm a beginner and I'm 
not yet used to the specifics of everything. Ofcourse I also googled 
before I asked but I did not find the \\\\.
thanks again
bye

-- 
Posted via http://www.ruby-forum.com/.