我在学校的计算机上安装了python,但每当我重新启动时,它当然会丢失文件关联等等。我一直在构建一个批处理文件,试图帮助我解决这个问题,但我坚持使用ftype命令。
assoc .py=PythonFile
ftype PythonFile="H:\profile\programs\Python34\python.exe" "%1" "%*"
出现问题,因为当我打开python文件时,我得到错误:H:\profile\programs\Python34\python.exe: can't find '__main__' module in ''
我不明白这一点。我在ftype命令中尝试了%0,但我认为它将python文件与批处理文件本身相关联,因为当我运行任何python文件时,我得到了
File "init.cmd", line 1
@echo off
^
SyntaxError: invalid syntax
顺便说一下,我读到了这个答案。它没有帮助。 qazxsw poi
(如果在powershell中有替代品,我是开放的!:)提前谢谢你! 节日快乐!
Simple ftype command not working字符在批处理文件中具有特殊含义,因此您需要使用double %
“转义”它们:
%%