How to change file associations in Win 8.1 via command line
So we are looking to push out VLC to all computers in my organization, since there is a problem with windows media player. However I need a way to set all (is it possible to set all a programs defaults in one command?), or at least certain file types with VLC via command line, however when I try it's not working. We're on Windows 8.1 64bit
I'm using the assoc command. For example:
assoc .avi=VLC.avi
This "works" in so much as if you check assoc .avi than it successfully shows .avi=VLC.avi (and if you do ftype vlc.avi it returns the correct path to VLC player) but the file association doesn't actually change on the computer and .avi files still open with windows media. Does this not work in Win 8.1 or something? Is there any other way to make this work? I know you can do it via group policy but I'm having issues with that too...but most likely a conflict with one of our other many policies so if I could get it via command line it would be easiest. thanks
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
Pressanykey
8 years ago
Hi,
doing a quick search, the most reliable way seems to be using dism and GPO...
here , here ,
as you stated, assoc seems to have problems and is apparently depreciated
However I found this link that shows how to change the permissions so that assoc should work...
After a bit more searching I found this method...
Use Ftype & Assoc to fix this (and it is scriptable).
Use Assoc to get the filetype
>Assoc .txt
gives you:
.txt = txtfile
Then
>Ftype txtfile=C:\Program Files (x86)\Notepad++\notepad++.exe %1
Once you know the file type you can use Ftype to associate it with an action.
This would work for .avifiles (just plop them in a batch file)
Assoc .avi=vlcavi
Ftype vlcavi="C:\Program Files (x86)\vlc.exe" %1
And you can copy these lines to add other text-based files as you would like.
This AFAIK needs to be done for every user (i.e. Active-Setup or Logon script)
If an extension is already on the system, or already assignedto an application, you would first have to get the correct identifier for the association.
Cheers
Phil
doing a quick search, the most reliable way seems to be using dism and GPO...
here , here ,
as you stated, assoc seems to have problems and is apparently depreciated
However I found this link that shows how to change the permissions so that assoc should work...
After a bit more searching I found this method...
Use Ftype & Assoc to fix this (and it is scriptable).
Use Assoc to get the filetype
>Assoc .txt
gives you:
.txt = txtfile
Then
>Ftype txtfile=C:\Program Files (x86)\Notepad++\notepad++.exe %1
Once you know the file type you can use Ftype to associate it with an action.
This would work for .avifiles (just plop them in a batch file)
Assoc .avi=vlcavi
Ftype vlcavi="C:\Program Files (x86)\vlc.exe" %1
And you can copy these lines to add other text-based files as you would like.
This AFAIK needs to be done for every user (i.e. Active-Setup or Logon script)
If an extension is already on the system, or already assignedto an application, you would first have to get the correct identifier for the association.
Cheers
Phil
Comments:
-
Thanks!! This article ( http://damonjohns.com/2013/08/16/how-to-deploy-windows-8-enterprise-file-type-associations/ ) specifically did the trick for me. Seems that using an xml file to set all file associations via group policy is the most efficient way of taking care of this. - winterelegy 8 years ago