Unable to associate extensions/file types with BAT scripts

  1. Posts : 4
    Windows 10

    Unable to associate extensions/file types with BAT scripts

    Using the assoc and ftype commands, I was always been able to associate certain extensions/filetypes with certain Batch scripts. But, this didn't appear to be be working in Windows 10.

    The following commands (run in a Admin command prompt) work fine in Windows 8.1 but not Windows 10:
    assoc .foo=Foobar
    ftype Foobar=C:\WINDOWS\system32\foo.bat %1
    echo @echo off > foo.bat
    echo echo The filename is %1>> foo.bat
    echo hi > foo.foo

    The result should be the output:
    The filename is C:\WINDOWS\system32\foo.foo
    Windows 10 appears to do nothing, but then I thought of changing the foo.bat script to redirect to a log file, so foo.bat now looks like this:
    @echo off
    echo The filename is %1 > foo.log
    When running foo.foo, foo.log is created, so we know that the file association (.foo files associated to foo.bat) is working and foo.bat is running. It's just that there's no output in the DOS window.

    Also, adding a "pause" command at the end of foo.bat does NOT pause at all, so this shows that input and output are both broken/redirected.

    What could be causing this input/output redirection? Remember, it only happens when running the foo.foo file directly. If you run "foo.bat foo.foo", it's fine.

    Last edited by jimtut; 11 Aug 2016 at 10:02. Reason: formatting
      My Computer

  2. Posts : 4
    Windows 10
    Thread Starter


    Looks like Microsoft changed the polarity of a setting in the registry for Windows 10, and there's a simple fix for it.


    Set HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\InheritConsoleHandles to 0.
      My Computer


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 06:17.
Find Us

Windows 10 Forums