PowerShell kv – save snippets of text that you can later find and copy to your clipboard

October 22, 2012

in PowerShell,PowerShell V3

PowerShell kv is a key value store that allows you to save snippets of text that you can later find and copy to your clipboard. Get it here on GitHub.

Inspired by secretGeek’s post kv can remember it for you, wholesale.

Store and Retrieve Values

# Saves the the value, 'John Doe' under the key, 'name'            
kv name "John Doe"            
            
# Retrieve the value 'John Doe' straight to your clipboard
kv name

List Keys and Remove Them

# Lists all keys             
kv             
            
# Removes the key 'name' and its value from the store            
kv -r name

You can also pipe data

# Stores 'Hello John' under the key 'Greeting'            
'Hello John' | kv Greeting              
            
# Stores the content of 'kv.ps1' under the key 'TheFile'            
gc .\kv.ps1 | kv TheFile

Where’s the data?

The key values are stored in in the folder $env:LOCALAPPDATA\kv\kvps.snippet using the Export-CliXml.

$hastable | Export-CliXml $env:LOCALAPPDATA\kv\kvps.snippet

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Contrat Creative Commons

© 2007-2013, Doug Finke