|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
做了一个口令保管箱程序,根据书上说的 创建了一个bat格式的批处理文本
程序代码如下,保存为pw.py
- #! python3
- # -*- coding: utf-8 -*-
- # An insecure password locker program.
- PASSWORDS = {
- 'email':'khfoejhiofuioHuohIOJOJFGOJjL124',
- 'wechat':'jljel2ljil291LJLDL',
- 'QQ':'ljioldluiljlv12',
- 'blog':'dll;;235l6',
- 'weibo':'deurp3irljkp;k;kfd2l;g;d.zjd;kf;g;'}
-
- import sys,pyperclip
- if len(sys.argv) < 2:
- print('Usage: python pw.py [account] - copy account password')
- sys.exit()
-
- account = sys.argv[1] # first command line arg is the account name
- if account in PASSWORDS:
- pyperclip.copy(PASSWORDS[account])
- print('Password for ' + account + 'copid to clipboard.')
- else:
- print('There is no account named ' + account)
复制代码
然后创建了一个bat文件
- @py.exe C:\MyPythonScripts\pw.py %*
- @pause
复制代码
保存为pw.bat
pw.bat和py.bat都保存在了"C:\MyPythonScripts"文件夹中。
然后将"C:\MyPythonScripts"加入到了环境变量里。
然后win+r 输入pw<QQ>
提示错误。
命令行参数不是很懂,照葫芦画瓢做的,求教后面应该怎么做。
|
|