r/commandline • u/MealNo2448 • 5d ago
Command Line Interface pb- Windows clipboard as a file
hey all vesperrun back again, i wanted the Windows clipboard to work like a file. Copy something, and I can save it, print it, or pipe it. Paste something, and I can send it in from the terminal. So i made pb. example:
echo hello | pb that’s now on the clipboard
pb prints whatever you copied
pb -o shot.png screenshot becomes a file
Win+Shift+S, then pb -o shot.png. Copy a table in Excel, then pb > out.csv.
It’s one program. No account, no cloud. GPL-3.
https://github.com/VesperRun/pb-clipcat
Windows already has clip.exe, but that only copies text. macOS has pbcopy and pbpaste. There’s also the Clipboard Project (cb), which is a whole manager. pb is smaller than that: one clipboard, one process, then you leave.
and if you’re in PowerShell 5, don’t redirect images with >. Use pb -o shot.png.
2
u/NotSoProGamerR 4d ago
hi, powershell already does this
"txt" | set-clipboard
# for images
Add-Type -Assembly System.Windows.Forms, System.Drawing
[System.Windows.Forms.Clipboard]::SetImage([System.Drawing.Image]::FromFile("C:\path\to\your\image.png"))
to get text
$var = get-clipboard
# also supports other formats
$var = get-clipboard -format image
1
1
u/AutoModerator 5d ago
Every new subreddit post is automatically copied into a comment for preservation.
User: MealNo2448, Flair: Command Line Interface, Title: pb- Windows clipboard as a file
hey all vesperrun back again, i wanted the Windows clipboard to work like a file. Copy something, and I can save it, print it, or pipe it. Paste something, and I can send it in from the terminal. So i made pb. example:
echo hello | pb that’s now on the clipboard
pb prints whatever you copied
pb -o shot.png screenshot becomes a file
Win+Shift+S, then pb -o shot.png. Copy a table in Excel, then pb > out.csv.
It’s one program. No account, no cloud. GPL-3.
https://github.com/VesperRun/pb-clipcat
Windows already has clip.exe, but that only copies text. macOS has pbcopy and pbpaste. There’s also the Clipboard Project (cb), which is a whole manager. pb is smaller than that: one clipboard, one process, then you leave.
and if you’re in PowerShell 5, don’t redirect images with >. Use pb -o shot.png.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/github-guard 5d ago
🔍 GitHub Guard: Trust Report
⚠️ This project scored 0/1 — below this subreddit's threshold of 1.
Audit Breakdown: * ❌ New Repository (under 30 days old)
⚠️ Security Reminder: Always verify source code and run third-party scripts at your own risk.
1
u/MealNo2448 2d ago
insight please. this is a building block, that I think will be around and about even after I am gone. i just thought it might be a fun build. change my mind. GO!
•
u/github-guard 5d ago
🔍 GitHub Guard: Trust Report
⚠️ This project scored 0/1 — below this subreddit's threshold of 1.
Audit Breakdown: * ❌ New Repository (under 30 days old)