AHK:使用args运行python脚本 [英] Ahk: run a python script with args

查看:386
本文介绍了AHK:使用args运行python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了这个线程(以及许多其他线程),但是我仍然无法在python中检索args.

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

1)这样...

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

... Cmd已打开,但没有任何反应:my.py未启动.

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

2)有了这个...

2) With this...

Run C:\my1.py %myvar% 

... python脚本正在运行,但是当我用sys.argv检索args时,我只得到脚本的路径,而不是myvar. Len(sys.arg)返回1,因此不会将myvar传递给python.

... 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.

推荐答案

也可以使用Run, cmd /k %commands%Run,%comspec% /k %commands%

这篇关于AHK:使用args运行python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆