Windows 10: Unable to associate extensions/file types with BAT scripts Solved

  1.    11 Aug 2016 #1

    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:
    Code:
    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
    foo.foo


    The result should be the output:
    Code:
    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:
    Code:
    @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.

    Thanks!
    Last edited by jimtut; 11 Aug 2016 at 10:02. Reason: formatting
      My ComputerSystem Spec

  2.    11 Aug 2016 #2

    Solution!


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

    https://social.msdn.microsoft.com/Fo...rum=windowssdk

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


 

Related Threads
I had installed a program to convert some video files to a type I can play with an xbox. After I downloaded the program I noticed a bunch of the icons on my desktop were now this: 84503 I immediately uninstalled the program and ran virus...
Hi there does anybody have any decent batch file renaming software or scripts. Here's a whole slew of music files from BBC Radio 3 -- what I want is after the word Breakfast in the title to insert date and time (european format YYMMDD.HHMM -24...
Apparently, Ondrive will ONLY allow you to upload .mp3 and .wma files....I have an enormous amount of ripped from CD and elsewhere .flac files, which are true lossless format that I wanted to put on Onedrive....and here's the amazingly, yet classic...
I was using FileTypesMan, but it seems to revert to default settings every time I restart the computer.
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 00:02.
Find Us