« Previous Next »

Answered Thread: Apostrophe Excape Need in Folder Path - Using Log Parser as an object in vbscript

Last post 02-02-2009 9:01 AM by qbernard. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 01-31-2009, 9:09 PM

    Apostrophe Excape Need in Folder Path - Using Log Parser as an object in vbscript


    Hi,
     
       I am running logparser, in a vbs script using the logparser object.


    The vbs file that runs logparser is below. It places all the files of a folder (recursing) and places them in a text file.
    =============================================
    Dim objLogParser, objInputFormat, objOutputFormat, strQuery
    Set objLogParser = CreateObject("MSUtil.LogQuery")
    Set objInputFormat = CreateObject("MSUtil.LogQuery.FileSystemInputFormat")
    Set objOutputFormat = CreateObject("MSUtil.LogQuery.TSVOutputFormat")

    strQuery = "SELECT Name, Size INTO 'C:\Ed's Scripts\Output2.txt' FROM 'C:\Tom's Scripts\Before*.*' ORDER BY Name ASC"
    objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat

    Apparently Log Parser cannot handle the apostrophe.

    =============================================
    How can I escape any apostrophes in my strQuery?
     
    (Unfortunately my computer is loaded with folder names with apostrophes I am using XP, and this is the first brick wall I have hit on this subject.)

    In the help file, it says you should be able to escape the apostrophe.

    Like (?):
    strQuery = "SELECT Name, Size INTO 'C:\Ed\'s Scripts\Output2.txt' FROM 'C:\Tom\'s Scripts\Before*.*' ORDER BY Name ASC"

    But LogParser does not understand that the backslash is "escaping the apostrophe".

    Am I escaping incorrectly?

    I have tried escaping with unicode (U0027) also.

    I have tried everything I can think of. Any help would be greatly appreciated!!!!!!!

    Other than this big obstacle, I am thrilled with the potential of log parser for me !!!!!


    Thanks, Ed

     

  • 02-01-2009, 3:18 PM In reply to

    Answered Re: Apostrophe Excape Need in Folder Path - Using Log Parser as an object in vbscript

     

       Since this is not getting much attention, I kept at it so I could answer my own post.

    I have found that I can escape the apostrophe one and only one way. I must use the unicode hexadecimal code for the apostrophe ( = u0027).

    However it will only work if you also use the backslash (as if you were escaping it).

    In other words:

    If in my strQuery I need From 'C:\Ed's Scripts\*.*'  then I use:

     FROM 'C:\Ed\u0027s Scripts\*.*'

    and voila I have included the "illegal" apostrope the folder name.

      If anyone else has additional ways, I would like to hear them.

     ..... Ed (guy who usually has to answer his own posts) 

     

  • 02-02-2009, 9:01 AM In reply to

    Re: Apostrophe Excape Need in Folder Path - Using Log Parser as an object in vbscript

    :) that should be the way :)
    Cheers,
    Bernard Cheah
Page 1 of 1 (3 items)
Microsoft Communities