I've got a bat file that I pieced together to change .xml's default program to Chrome

ftype doc.Document="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
assoc .xml=doc.Document

It appears to work. When I check its associated program via the Set Associations interface it is correct. However, when I try to open an xml, it simply launches chrome as if I had opened a new instance of chrome and does not open the xml.

At this point, if I manually change the associations via the Set Associations page to some other program and then back to Chrome again, it remains broken (launches a new instance of chrome) instead of behaving as if I had originally just used this interface (where it would open the xml in tabbed plain text).

So I guess my question is what is my bat missing? If my bat isn't missing anything, then what can I do to return to the expected functionality?

有帮助吗?

解决方案

Should add file to be transmitted to chrome as parameter (add %1 as parameter to chrome):

ftype doc.Document="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "%%1"

This works for a batch file. Keep in mind that you need a single % for the command prompt.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top