Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Answered Select-String with .ppt files

  • Tuesday, February 12, 2013 2:59 AM
     
     

    Hey Scripting Guy!

    This is a basic question, but has me stumped. I have trawled the web for the uses of 'select-string' and everywhere says I can use it to search for text in: .doc, .xls, .ppt, .txt etc. Now I can get it to work no probs with .doc files, but when I point it at .ppt files I get no results...??? Below is a basic version of what im trying to acheive. I dummed it down to see if it would work in its basic form and no joy...what am I doing wrong?! The target powerpoint file has a slide with the word alpha as a title. Help Pls!


    # PowerShell cmdlet to find the word "alpha". 
    $Location = "c:\scripts\testppt1.ppt"
    $SearchStr = "alpha"
    $Sel = Select-String  -pattern $SearchStr -path $Location 
    If ($Sel -eq $null)
    {
        write-host "$Location does not contain $SearchStr"
    }
    Else 
    {
        write-host "Found `n$Sel"


    Write-host "end"

All Replies

  • Tuesday, February 12, 2013 3:10 AM
     
     Answered

    Typical...I spend all that time trying to figure it out and the moment I post on here I figure out what the issue is!

    I forgot that I renamed a .pptx file to .ppt (a test file) and that seems to be causing the issue. I created a new file from scratch in .ppt format and select-string works.

    thanks anyway

  • Tuesday, February 12, 2013 7:34 AM
     
     

    If you want to search for text inside a .docx, .xlsx or .pptx - I would suggest you look at the project Power Tools for Open XML over at Codeplex
    http://powertools.codeplex.com/

    Their Select-OpenXMLString command has similar functionality for OOXML documents:
    http://openxmldeveloper.org/wiki/w/wiki/powertools-for-open-xml-2-0-cmdlets.aspx


    Best Regards
    Claus Codam
    Consultant, Developer
    Coretech - Blog



    • Edited by Claus Codam Tuesday, February 12, 2013 7:37 AM grammar
    •