New
#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:
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:The filename is C:\WINDOWS\system32\foo.foo
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.Code:@echo off echo The filename is %1 > foo.log
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