Jul-22-2018, 10:58 PM
I wrote a simple password management program and have a problem to utilize it since I don't quite understand what batch file is and how to use it.
code with filename
I used the same folder for putting pw.py and batch file pw.bat. Is this ok? The instructions say:
With this batch file created, running the password-safe program on Windows is just a matter of pressing WIN-R and typing pw <account name>.
This doesn't work for me, but I may did something wrong. When WIN-R windows opens I type for example "pw yahoo" but it says that windows cannot find that file.
When I start
code with filename
pw.py:#! python3
# pw.py - An insecure password locker program
PASSWORDS = {'yahoo': 'alpha',
'linkedin': 'beta',
'youtube': 'beta',
'job': 'gama',
'python-io': 'delta' }
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 argue is the account name
if account in PASSWORDS:
pyperclip.copy(PASSWORDS[account])
print('Password for ' + account + ' copied to clipboard')
else:
print('There is no account named ' + account)Now, following instructions I created this batch file:@py.exe C:\Python36\kodovi\pw.py %* @pause...and named it
pw.batI used the same folder for putting pw.py and batch file pw.bat. Is this ok? The instructions say:
With this batch file created, running the password-safe program on Windows is just a matter of pressing WIN-R and typing pw <account name>.
This doesn't work for me, but I may did something wrong. When WIN-R windows opens I type for example "pw yahoo" but it says that windows cannot find that file.
When I start
pw.py the outcome is:Output:C:\Python36\kodovi>pw.py yahoo
Password for yahoo copied to clipboardWhat is actually the correct way to start this program?
