Can't Set File Associations (Properly)

This topic contains 2 replies, has 1 voice, and was last updated by Profile photo of Simon Broad Simon Broad 10 months, 1 week ago.

  • Author
  • #33099
    Profile photo of Simon Broad
    Simon Broad

    I created a custom resource to set file associations and it works, sometimes.
    As I'm explaining the problem here I'm realizing it is probably not a DSC, maybe not even a powershell, problem – but all the smart people are here, so can I ask it anyway, or is there a more appropriate forum I should go to?

    I use my custom resource to set file association for .txt and .log to notepad++.exe
    But when a user double-clicks a .txt file it won't open, but a .log file will.

    In my resource I use assoc and ftype to set the associations.
    The correct filetype is set.

    C:\Users\simon>assoc | grep txt

    And this is associated with the right exe file:

    C:\Users\simon>ftype txtfile
    txtfile="C:\Program Files (x86)\Notepad++\notepad++.exe" %1 %*

    But it still remains that the txt file, when double-clicked on by a user, presents a popup to ask what application is they want to use to open the file, while the log file opens.

    I have used the same file, changing it's extension through .log .txt .scp and .wtx (all the txtfile extension in my system). They all launch notepad++ except .txt

    I'm confused.

  • #33100
    Profile photo of Simon Broad
    Simon Broad

    Digging deeper, Running
    "C:\Program Files (x86)\Notepad++\notepad++.exe" C:\eula.1028.txt
    on the command line does successfully launch notepad++ with the correct file

  • #33101
    Profile photo of Simon Broad
    Simon Broad

    Digging deeper still. XML files.
    I haven't touched the XML file configuration, it says:

    C:\Users\simon>assoc .xml


    C:\Users\simon>ftype xmlfile
    xmlfile="C:\Program Files\Internet Explorer\iexplore.exe" %1

    But double-clicking an xml file also presents the popup asking for an application, and running "C:\Program Files\Internet Explorer\iexplore.exe" does launch IE.

    Sorry, this really is a Window Setup issue, isn't it?

You must be logged in to reply to this topic.