如何仅通过在 Windows 10 cmd 行上键入脚本名称来运行 python 程序?也无需更改目录。我已经将我的脚本文件夹和 python 文件夹添加到路径中。也试过你运行 assoc py.=PythonScript ftype PythonScript=python.exe %1 %*
这是程序的内容:
#! python3
# mapIt.py - Launches a map in the browser using an address from the command line or clipboard
import webbrowser, sys, pyperclip
if len(sys.argv) > 1:
address = ' '.join(sys.argv[1:])
else:
address = pyperclip.paste()
webbrowser.open('https://www.google.com/maps/place/' + address)
我添加了一个屏幕截图,其中包含到目前为止我尝试过的所有命令。
慕神8447489
相关分类