Ahk: run a python script with args

依然范特西╮ 提交于 2019-12-05 07:21:37

问题


I have seen this thread (and many others) but I am still not able to retrieve the args in python.

1) With this...

Run Cmd \k "Python  C:\my.py %myvar%"

... a Cmd is open but nothing happens : my.py isn't started.

2) With this...

Run C:\my1.py %myvar% 

... the python script is run but when I retrieve the args with sys.argv, I only get the path of the script not myvar. Len(sys.arg) return 1 so myvar isn't passed down to python.


回答1:


This thread solved it.

commands=
(join&
 python "C:\my.py" "%myvar%"`n
)
Run, cmd /c %commands%  
return

It's also possible to use Run, cmd /k %commands% or Run,%comspec% /k %commands%



来源:https://stackoverflow.com/questions/47969375/ahk-run-a-python-script-with-args

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