Board logo

标题: [已解决]设置文件关联后无效 [打印本页]

作者: moniuming     时间: 2008-7-19 14:11    标题: [已解决]设置文件关联后无效

我用以下的代码设置文件关联,双击MP3和WMA文件后,还是用WINDOWS MEDIA PLAYER打开MP3,而不是TTPLAYER,希望大家看看问题出在哪里,如何修改,或修改注册表也可以,谢谢!!!
@echo off
assoc .mp3=mp3file
ftype mp3file="d:\program files\ttplayer\ttplayer.exe" "%%1"
assoc .wma=wmafile
ftype wmafile="d:\program files\ttplayer\ttplayer.exe" "%%1"
[ Last edited by moniuming on 2008-7-20 at 12:52 PM ]

作者: jsunhj     时间: 2008-7-19 14:21
@echo off assoc .mp3=mp3file ftype mp3file="d:\program files\ttplayer\ttplayer.exe" %1 assoc .wma=wmafile ftype wmafile="d:\program files\ttplayer\ttplayer.exe" %1

作者: slore     时间: 2008-7-19 14:21
先 ftpe 在 assoc 貌似不要带空格

作者: moniuming     时间: 2008-7-19 14:41
这样改还是不行啊
@echo off
ftype mp3file="d:\program files\ttplayer\ttplayer.exe" "%%1"
assoc .mp3=mp3file
ftype wmafile="d:\program files\ttplayer\ttplayer.exe" "%%1"
assoc .wma=wmafile

作者: mountvol     时间: 2008-7-19 15:07
明显地,"%%1"被当作ftype的参数了,不过ttplayer里面应该有设置关联的功能,何必这么麻烦。

作者: moniuming     时间: 2008-7-19 16:36
在图形界面下修改我也会,这跟麻烦不麻烦无关,我只是想把这个命令弄明白,继续求教!!!

作者: slore     时间: 2008-7-19 18:03
TTplayer 设置的关联是Audio.mp3 因为默认的mp3file……怎么说呢 那个命令是对的,不用颠倒。但是ftype修改的是open的命令…… 而mp3和wma因为wmp的原因默认的方式是play 所以应上面的bat是没有效果。。。播放菜单的打开程序还是wmp 自己建立一个类型比如mymp3……然后注册表改成相关……然后assoc就行了。

作者: moniuming     时间: 2008-7-19 19:17    标题: 回7楼

我不懂注册表啊

作者: HAT     时间: 2008-7-19 19:35
1. 你不需要懂注册表 2. 用regsnap扫描注册表 3. 手工修改MP3和WMA文件的默认打开方式 4. 再次用regsnap扫描注册表 5. 比较两次扫描结果找出不同的地方

作者: moniuming     时间: 2008-7-19 19:42
哪里有regsnap啊

作者: HAT     时间: 2008-7-19 19:56
RegSnap V5.0 rthost.fam.cx/cndos- ... google和baidu有

作者: moniuming     时间: 2008-7-19 20:05
无法下载 不知道MP3默认打开方式的键在注册表的哪个地方呀

作者: slore     时间: 2008-7-19 20:09
... 说了随便啥类型…… Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Audio.MP3] @="MP3 音频文件" [HKEY_CLASSES_ROOT\Audio.MP3\DefaultIcon] @="\"E:\\TTPlayer\\TTPlayer.exe\",1" [HKEY_CLASSES_ROOT\Audio.MP3\shell] @="open" [HKEY_CLASSES_ROOT\Audio.MP3\shell\open\command] @="\"E:\\TTPlayer\\TTPlayer.exe\" \"%1\""

作者: HAT     时间: 2008-7-19 20:15
google: 约有57,000项符合regsnap的查询结果

作者: moniuming     时间: 2008-7-19 22:30
根据13楼作了以下代码,还是不成功 .reg文件:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Audio.MP3]
@="MP3 音频文件"

[HKEY_CLASSES_ROOT\Audio.MP3\DefaultIcon]
@="\"d:\\program files\\TTPlayer\\TTPlayer.exe\",1"

[HKEY_CLASSES_ROOT\Audio.MP3\shell]
@="open"

[HKEY_CLASSES_ROOT\Audio.MP3\shell\open\command]
@="\"d:\\program files\\TTPlayer\\TTPlayer.exe\" \"%1\""
.bat文件
@echo off
assoc .mp3=audio.mp3
ftype audio.mp3="d:\program files\ttplayer\ttplayer.exe\" "%%1"
pause

作者: slore     时间: 2008-7-19 23:12
注册表导入后,直接assoc.mp3=Audio.MP3应该就可以了。 你打开注册表看下。还有你的mp3的右键菜单是什么样子。在文件夹选项里看看MP3文件又是如何的……

作者: moniuming     时间: 2008-7-19 23:59
还是不行, 注册表已经被改写, MP3的右键菜单有那么几项: 1.播放(P) 2.打开(O) 3.添加到"Windows Media Player"播放列表(W) 4.打开方式(H) 文件夹选项里MP3的打开方式是WINDOWS MEDIA PLAYER,图标也一样,在"MP3"扩展名详细信息里有以下的提示: 您已用扩展名"MP3"自定义文件.要将这些文件还原为其默认类型(MP3音频文件),请单击"还原". 单击"还原"按钮后,MP3文件的图标就变为了TTPLAYER的图标,双击MP3文件也是用TTPLAYER来播放的. [ Last edited by moniuming on 2008-7-20 at 12:09 AM ]

作者: moniuming     时间: 2008-7-20 12:11
把.reg文件改成批处理文件竟然成功了,怪... 在此非常感谢slorehat的帮助,谢谢两位!!!
@echo off
reg add "hklm\software\classes\audio.mp3" /ve /d "MP3 音频文件" /f
reg add "hklm\software\classes\audio.mp3\defaulticon" /ve /d "\"d:\program files\ttplayer\ttplayer.exe\",1" /f
reg add "hklm\software\classes\audio.mp3\shell" /ve /d "open" /f
reg add "hklm\software\classes\audio.mp3\shell\open\command" /ve /d "\"d:\program files\ttplayer\ttplayer.exe\" \"%%1\""
reg add "hklm\software\classes\audio.wma" /ve /d "WMA 音频文件" /f
reg add "hklm\software\classes\audio.wma\defaulticon" /ve /d "\"d:\program files\ttplayer\ttplayer.exe\",1" /f
reg add "hklm\software\classes\audio.wma\shell" /ve /d "open" /f
reg add "hklm\software\classes\audio.wma\shell\open\command" /ve /d "\"d:\program files\ttplayer\ttplayer.exe\" \"%%1\""
assoc .mp3=audio.mp3
assoc .wma=audio.wma
ftype audio.mp3="d:\program files\ttplayer\ttplayer.exe" "%%1"
ftype audio.wma="d:\program files\ttplayer\ttplayer.exe" "%%1"
pause

作者: mkd     时间: 2008-7-20 12:22
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.mp3 /v Application /f

作者: wert123     时间: 2008-7-20 20:39
Originally posted by HAT at 2008-7-19 07:35 PM: 1. 你不需要懂注册表 2. 用regsnap扫描注册表 3. 手工修改MP3和WMA文件的默认打开方式 4. 再次用regsnap扫描注册表 5. 比较两次扫描结果找出不同的地方