Simple ftype command not working

僤鯓⒐⒋嵵緔 提交于 2020-01-16 06:40:42

问题


I am trying to get ftype create a new filetype but it is not working :(. Here is my command: ftype testing="cmd.exe" "%1" but it says File type 'testing' not found or no open command associated with it.

I don't know why it is not working, I also followed the documentation mentioned in MSDN.


回答1:


Those commands seems not working in Vista or superior.

You don't need that anymore. Simply adjust your REGISTRY using REG.EXE command to make associations:

REM COMMENT
REM THIS IS AN EXAMPLE. CREATE ABOVE BATCH FILE AND EXECUTE IT.
REM You will be able to open Python files 

reg.exe add "%key%\.py" /f /t REG_SZ /d "Python.File" >NUL 2>NUL

reg.exe add "%key%\Python.File" /f /t REG_SZ /d "Python File" >NUL 2>NUL

reg.exe add "%key%\Python.File\DefaultIcon" /f /t REG_SZ /d "%pyhome%DLLs\py.ico" >NUL 2>NUL

reg.exe add "%key%\Python.File\shell\Edit with IDLE\command" /f /t REG_SZ /d "\"%pyhome%pythonw.exe\" \"%pyhome%Lib\idlelib\idle.pyw\" -e \"%%1\"" >NUL 2>NUL

reg.exe add "%key%\Python.File\shell\open\command" /f /t REG_SZ /d "\"%pyhome%pywin.bat\" \"%%1\" %%*" >NUL 2>NUL

reg.exe add "%key%\Python.File\shellex\DropHandler" /f /t REG_SZ /d "{60254CA5-953B-11CF-8C96-00AA00B8708C}" >NUL 2>NUL



回答2:


you need something like:

assoc .test=testfile
ftype testfile="cmd.exe" "%1" %*

though it will be not possible to create a file extension that acts like .bat file - because of security reasons windows will not allow this.Here's an workaround.



来源:https://stackoverflow.com/questions/35669120/simple-ftype-command-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!