Batch file - onlykey CLI


I want to write a batch file to change the password on a particular slot when it is run without user interaction. Is this possible?


You could put the OnlyKey CLI commands into a batch file. I am not sure what you mean by without user interaction. You can’t type out passwords without touching device.

Hi Keir, have also wondered if this is possible as well. For all other settings you can specify the new value non-interactively on the command line, for example:

onlykey-cli setslot 1a label test1
Successfully set Label

onlykey-cli setslot 1a username user1
Successfully set Username

However for the password, if you try the same, it will interactively prompt you to enter the password even if you had included it on the command line:

onlykey-cli setslot 1a password my_password

Type Control-T to toggle password visible.

So far the one potential workaround may be to specify both username and password including the separator into the username field (and then use a blank password field):

onlykey-cli setslot 1a username “user1 \t my_password”
Successfully set Username

Has anyone found a more effective workaround to the above?


By the way, for the above to work, your key may have to have Sysadmin mode enabled.