{"id":9248,"date":"2019-05-12T09:19:08","date_gmt":"2019-05-12T03:49:08","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=9248"},"modified":"2024-04-17T21:12:24","modified_gmt":"2024-04-17T15:42:24","slug":"set-default-browser-file-associations-command-line-windows-10","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/set-default-browser-file-associations-command-line-windows-10\/","title":{"rendered":"Change Default Apps and File Association via Command-line"},"content":{"rendered":"<p><em><strong>Summary:<\/strong> This post explains how to change the default apps or file associations using the command-line in Windows 10 and 11. This can be accomplished by a command-line tool named SetUserFTA.<\/em><!--more--><\/p>\n<p>In Windows 10 and 11, setting per-user file associations for a logged-on user account has to be done manually using Default Apps or the &#8220;Open with&#8221; dialog. If you try to change the user default registry entries using a script or batch file, Windows will <a href=\"https:\/\/www.winhelponline.com\/blog\/edge-hijack-pdf-htm-associations\/\">reset the file association<\/a> to Windows defaults; you&#8217;ll see the annoying <a href=\"https:\/\/www.winhelponline.com\/blog\/windows-10-resetting-file-associations\/\" target=\"_blank\" rel=\"noopener noreferrer\">An app default was reset<\/a> notification.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-9252\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/browser-default-reset.png\" alt=\"Set Default Browser and File Associations via Command-line\" width=\"344\" height=\"146\" \/><\/p>\n<h2>Cause<\/h2>\n<p>Microsoft says <a href=\"https:\/\/blogs.technet.microsoft.com\/windowsinternals\/2017\/10\/25\/windows-10-how-to-configure-file-associations-for-it-pros\/\" target=\"_blank\" rel=\"noopener noreferrer\">applications must not write<\/a> to the <code>UserChoice<\/code> registry key, which stores the user-default association settings. This is because the user must be in control, not the programs. Programs competing with each other and arbitrarily changing the user-specific associations will not be a good user experience. The <code>UserChoice<\/code> key is a protected location, and the ProgID value is validated with a hash.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-9251\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/userchoice-hash.png\" alt=\"Set Default Browser and File Associations via Command-line\" width=\"699\" height=\"174\" \/><\/p>\n<p>When you use <strong>Default Apps<\/strong> or <strong>Open with<\/strong> to set associations, Windows 10\/11 generates the hash for each file type association. The hash generated is based on many inputs, such as user account SID, ProgId, registry time, etc., and perhaps other parameters.<\/p>\n<p>Users may sometimes need a shortcut method to set file associations for their account without going through the Open with dialog or Default Apps every time. A toggle switch or shortcut to change browser or file association defaults would greatly help.<\/p>\n<p>Fortunately, we have the <strong>SetUserFTA<\/strong> utility to do that.<\/p>\n<p>To set the file association and default browser via command-line, use the <a href=\"http:\/\/kolbi.cz\/blog\/2017\/10\/25\/setuserfta-userchoice-hash-defeated-set-file-type-associations-per-user\/\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">SetUserFTA<\/a> utility written by Christoph Kolbicz. Kolbicz has reverse-engineered the hashing algorithm effectively. This utility generates the hash automatically and sets the defaults for you.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9255\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/setuserfta.png\" alt=\"Set Default Browser and File Associations via Command-line\" width=\"700\" height=\"205\" \/><\/p>\n<h2>Set Default Apps, Browser, or Associations via Command-line<\/h2>\n<div class=\"qt\">\n<h3>Important<\/h3>\n<p><strong>2024 Update:<\/strong> Since the February 2024 Cumulative Update, Windows has included a driver service named UCPD.sys (User Choice Protection Driver) stops users from writing to the &#8220;UserChoice&#8221; registry key, especially for protocols <strong>http<\/strong>, <strong>https,<\/strong> and file type .<strong>pdf<\/strong>.<\/p>\n<p>So, if the UCPD driver is running, SetUserFTA will throw one of the following errors when setting associations.<\/p>\n<pre class=\"err\">\"Error: could not open registry key\"<\/pre>\n<pre class=\"err\">\"Key deletion failed. Error code: 5\"<\/pre>\n<pre class=\"err\">error: could not create registry key<\/pre>\n<pre class=\"err\">error: could not open registry key<\/pre>\n<p>For the SetUserFTA tool to work for all file types, including <strong>http<\/strong>, <strong>https<\/strong>, and <strong>pdf<\/strong>, you need to <strong>disable the UCPD driver<\/strong>.<\/p>\n<h4>Workaround: Disable the UCPD driver<\/h4>\n<p>To do so, run the following commands from an <a href=\"https:\/\/www.winhelponline.com\/blog\/open-elevated-command-prompt-windows\/\">admin Command Prompt<\/a> and restart Windows:<\/p>\n<pre class=\"cmd\">sc.exe config UCPD start= disabled<\/pre>\n<pre class=\"cmd\">schtasks.exe \/change \/Disable \/TN \"\\Microsoft\\Windows\\AppxDeploymentClient\\UCPD velocity\"<\/pre>\n<p><em>Read more at <a href=\"https:\/\/kolbi.cz\/blog\/2024\/04\/03\/userchoice-protection-driver-ucpd-sys\/\" target=\"_blank\" rel=\"noopener\">UserChoice Protection Driver \u2013 UCPD.sys \u2013 the kolbicz blog<\/a>.<\/em><\/p>\n<\/div>\n<p>After disabling the UCPD driver, do the following:<\/p>\n<p>To change the default browser using command-line, use this syntax:<\/p>\n<pre>SetUserFTA.exe extension progid<\/pre>\n<p>It also supports URL protocols (e.g., <code>http<\/code>, <code>https<\/code>, <code>mailto<\/code>, etc.)<\/p>\n<h3>Google Chrome<\/h3>\n<p>To set Chrome as the default browser, run these commands:<\/p>\n<pre>SetUserFTA  http ChromeHTML\nSetUserFTA  https ChromeHTML\nSetUserFTA  .htm ChromeHTML\nSetUserFTA  .html ChromeHTML<\/pre>\n<h3>Firefox<\/h3>\n<pre>SetUserFTA  http FirefoxHTML\nSetUserFTA  https FirefoxHTML\nSetUserFTA  .htm FirefoxHTML\nSetUserFTA  .html FirefoxHTML<\/pre>\n<h3>Opera<\/h3>\n<pre>SetUserFTA  http OperaStable\nSetUserFTA  htts OperaStable\nSetUserFTA  .htm OperaStable\nSetUserFTA  .html OperaStable<\/pre>\n<h3>Microsoft Edge (Chromium)<\/h3>\n<pre>SetUserFTA http MSEdgeHTM\nSetUserFTA https MSEdgeHTM\nSetUserFTA microsoft-edge MSEdgeHTM\nSetUserFTA .htm MSEdgeHTM\nSetUserFTA .html MSEdgeHTM<\/pre>\n<h3>Microsoft Edge (legacy)<\/h3>\n<pre>SetUserFTA http AppXq0fevzme2pys62n3e0fbqa7peapykr8v\nSetUserFTA https AppX90nv6nhay5n6a98fnetv7tpk64pp35es\nSetUserFTA microsoft-edge AppX7rm9drdg8sk7vqndwj3sdjw11x96jc0y\nSetUserFTA .htm AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9\nSetUserFTA .html AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9<\/pre>\n<p><em><strong>RELATED:<\/strong> See article <a href=\"https:\/\/www.winhelponline.com\/blog\/remove-file-association-windows\/\">How to Remove File Type Associations Using the Registry Editor<\/a> for more information on File extension \u2192 ProgID mapping.<\/em><\/p>\n<h4>Default Image Viewer<\/h4>\n<p>To set Windows Photo Viewer as the default handler for .png and .jpg files, run:<\/p>\n<pre>SetUserFTA  .jpg  PhotoViewer.FileAssoc.Jpeg\nSetUserFTA  .png  PhotoViewer.FileAssoc.Png<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-9189\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/information-icon.png\" alt=\"\" width=\"32\" height=\"32\" \/><em>Note that you&#8217;ll have applied the Windows Photo Viewer registry edit as in the article <a href=\"https:\/\/www.winhelponline.com\/blog\/restore-windows-photo-viewer-windows-10\/\">Restore Missing Windows Photo Viewer in Windows 10<\/a> for the above commands to work. Without the necessary ProgId registration, your files will show up as an unknown file type.<\/em><\/p>\n<p>To revert to <strong>Microsoft Photos<\/strong> as the default, use this command-line:<\/p>\n<pre>SetUserFTA .jpg AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\nSetUserFTA .png AppX43hnxtbyyps62jhe9sqpdzxn1790zetc<\/pre>\n<h4>ProgID vs &#8220;Applications\\program.exe&#8221;<\/h4>\n<p>If an application doesn&#8217;t define a file class or Progid, you can mention the program&#8217;s exe as well, like <code>Applications\\program.exe<\/code> type as well. This works if the program is registered under <code>HKCR\\Applications<\/code> registry key.<\/p>\n<p>For example, to set Notepad++ as the default editor for .txt files, run:<\/p>\n<pre>SetUserFTA  .txt applications\\notepad++.exe<\/pre>\n<p>To revert to default (<code>notepad.exe<\/code>), use:<\/p>\n<pre>SetUserFTA  .txt txtfile\nor\nSetUserFTA  .txt applications\\notepad.exe<\/pre>\n<p>You may create desktop shortcuts for the required commands to switch defaults quickly in a single click!<\/p>\n<h3>View current user defaults for all file types<\/h3>\n<p>To get the user defaults for all file types and URL protocols, run the command:<\/p>\n<pre>SetUserFTA get<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9250\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/setuserfta-get.png\" alt=\"Set Default Browser and File Associations via Command-line\" width=\"700\" height=\"400\" \/><\/p>\n<p><em>SetUserFTA makes setting file associations easy! There is a similar utility from DanysysTeam, which I&#8217;ve not tested yet. To check it out, visit <a href=\"https:\/\/github.com\/DanysysTeam\/SFTA\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Set File Type Association Default Application Command Line<\/a><\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: This post explains how to change the default apps or file associations using the command-line in Windows 10 and 11. This can be accomplished by a command-line tool named SetUserFTA.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,8,869],"tags":[137,441],"class_list":["post-9248","post","type-post","status-publish","format-standard","hentry","category-utilities","category-windows-10","category-windows-11","tag-default-programs","tag-registry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1630,"url":"https:\/\/www.winhelponline.com\/blog\/windows-10-resetting-file-associations\/","url_meta":{"origin":9248,"position":0},"title":"Fix for &#8220;An App Default was Reset&#8221; Windows 10 Resets File Associations","author":"Ramesh","date":"February 13, 2016","format":false,"excerpt":"This post explains why Windows 10 resets your file associations for file types supported by modern apps like 3d Builder, Zune music, Zune video (Movies & TV), Microsoft Edge, and Microsoft Edge Chromium. RELATED: Set Default Browser and File Associations via Command-line in Windows 10 Cause The app defaults are\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"app default was reset - event log","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/app-default-reset-event-log.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/app-default-reset-event-log.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/app-default-reset-event-log.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":25987,"url":"https:\/\/www.winhelponline.com\/blog\/cant-associate-jpg-png-files-default-apps\/","url_meta":{"origin":9248,"position":1},"title":"[Fix] Can&#8217;t Change File Association via Default Apps in Windows 11","author":"Ramesh","date":"January 28, 2022","format":false,"excerpt":"After installing third-party software on your Windows 11 computer, the ability to associate file types such as JPG, JPE, JPEG, PNG, MPG, MPEG, and other file types may be hampered. Here are the issues you may encounter when attempting to change the file association for the said file types. When\u2026","rel":"","context":"In &quot;Windows 11&quot;","block_context":{"text":"Windows 11","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-11\/"},"img":{"alt_text":"windows 11 default apps can't associate file","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/w11-default-apps-asso-fix-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/w11-default-apps-asso-fix-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/w11-default-apps-asso-fix-3.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1627,"url":"https:\/\/www.winhelponline.com\/blog\/stop-photos-app-taking-over-image-file-associations\/","url_meta":{"origin":9248,"position":2},"title":"How to Stop Photos App from Resetting Image File Associations?","author":"Ramesh","date":"February 13, 2016","format":false,"excerpt":"This post explains how to prevent the modern Photos app from taking over the defaults for all image files types. We saw how to prevent Edge from taking over the PDF and HTM association settings. The same method can be used for the Photos app, or for any other app\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/w10\/w10-photos-takeover-3.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":75047,"url":"https:\/\/www.winhelponline.com\/blog\/cannot-associate-pdf-other-than-edge\/","url_meta":{"origin":9248,"position":3},"title":"Cannot associate .PDF with anything other than Microsoft Edge","author":"Ramesh","date":"May 3, 2024","format":false,"excerpt":"When you use Default Apps or Open With to associate .PDF files with Adobe Reader or any other app, nothing may happen. In some cases, the association will change for a brief time, and then it will revert to Microsoft Edge as the default. Possible Cause In recent builds of\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"taskkill all instances of microsoft edge msedge.exe","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2024\/05\/taskkill-msedge.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2024\/05\/taskkill-msedge.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2024\/05\/taskkill-msedge.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2024\/05\/taskkill-msedge.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2186,"url":"https:\/\/www.winhelponline.com\/blog\/default-apps-not-working-windows-10\/","url_meta":{"origin":9248,"position":4},"title":"Cannot Change Default Apps or Programs in Windows 10 [Fix]","author":"Ramesh","date":"March 18, 2016","format":false,"excerpt":"When you open Default apps and select a default program for Web browser, Email or any other item, the Choose an app dialog pops up but nothing happens when you select an item from the list. Here is a small video clip that explains the problem. I've been working on\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/03\/w1-10-change-file-asso-properties.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/03\/w1-10-change-file-asso-properties.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/03\/w1-10-change-file-asso-properties.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3220,"url":"https:\/\/www.winhelponline.com\/blog\/reset-wordpad-notepad-settings-defaults\/","url_meta":{"origin":9248,"position":5},"title":"How to Reset Notepad and WordPad to Default","author":"Ramesh","date":"June 7, 2016","format":false,"excerpt":"If you've changed the default font settings and other options in WordPad or Notepad and want to revert back to Windows default values, this post tells you how to do that. Reset Notepad settings If you've altered the default Notepad font or encoding (using the iDefaultEncoding registry value), the margin,\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"reset notepad store app","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/06\/notepad-uwp-app-reset.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/9248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=9248"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/9248\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=9248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=9248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=9248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}