我需要编写一个批处理脚本来将 .py 文件与 pythonw.exe 关联起来。所以我需要做两件事:1)找到pythonw.exe的路径,然后将.py文件关联起来,或者特别是afile.py与pythonw.exe。
我知道我可以像这样找到 pythonw.exe 的路径:
for %i in (python.exe) do @echo. %~$PATH:i
但是上面的命令不能在批处理文件中工作——而是只能在命令行中工作。
我也知道我可以使用
assoc
将文件扩展名与可执行文件相关联。
How do I put this all together into one batch file?