问题
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