Paste clipboard screenshots directly into Claude Code on Windows with a single
/pastecommand.
Claude Code's terminal accepts images by drag-and-drop from a folder, but Ctrl+V doesn't paste screenshots from the Windows clipboard. So whenever you Win+Shift+S or PrtScn something, you have to:
- Open Paint or a screenshot tool
- Save the image as a file
- Drag the file into the terminal
Three steps for something that should take zero. This package fixes that.
A custom /paste slash command. The flow becomes:
1. Take screenshot → PrtScn or Win+Shift+S
2. In Claude Code, type → /paste
3. Claude sees the image → done.
Under the hood, a tiny PowerShell script reads the bitmap from the Windows clipboard, saves it as a timestamped PNG in ~/.claude/clipboard-images/, and Claude reads the file — the image becomes a real visual attachment, identical to drag-and-drop.
In any PowerShell window:
irm https://raw.githubusercontent.com/Felipevieiraemp/claude-code-paste-image/main/install.ps1 | iexThen restart Claude Code so it picks up the new slash command.
-
Clone this repo (or download the ZIP).
-
Copy the two files into your Claude config:
Copy-Item commands\paste.md $env:USERPROFILE\.claude\commands\paste.md Copy-Item scripts\paste-clipboard-image.ps1 $env:USERPROFILE\.claude\scripts\paste-clipboard-image.ps1
Create the
commands\andscripts\folders first if they don't exist. -
Restart Claude Code.
[take screenshot with PrtScn or Win+Shift+S]
> /paste
Claude will:
- Run the PowerShell extractor
- Save the clipboard image as
~/.claude/clipboard-images/screenshot-<timestamp>.png - Load the PNG as a visible attachment
- Briefly describe what was pasted (so you know it landed correctly)
- Wait for your next instruction
You can also pass arguments after /paste and they'll be appended to the prompt — for example:
> /paste explain what this error means
commands/paste.md— a Claude Code custom slash command. When you type/paste, this prompt template tells Claude exactly what to do: run the script, parse the output, and load the file with theReadtool.scripts/paste-clipboard-image.ps1— usesSystem.Windows.Forms.Clipboard.GetImage()to grab the bitmap, thenImage.Save(..., ImageFormat.Png)to encode it. Outputs the file path on stdout, orERROR: <reason>on failure.
That's the whole project. Two files, no dependencies, no daemons, no installers — just plumbing that should have been there to begin with.
- Windows 10 or 11 (uses Windows Forms clipboard APIs)
- PowerShell 5.1+ — built into Windows, nothing to install
- Claude Code — any recent version that supports custom slash commands in
~/.claude/commands/
Not on Windows? The same idea works on macOS (pngpaste + a wrapper script) and Linux (xclip -selection clipboard -t image/png -o). PRs welcome.
~/.claude/
├── commands/
│ └── paste.md ← the slash command
├── scripts/
│ └── paste-clipboard-image.ps1 ← the clipboard extractor
└── clipboard-images/ ← saved PNGs (created on first paste)
└── screenshot-20260509-143022-123.png
└── screenshot-20260509-143108-456.png
└── ...
The clipboard-images/ folder is never auto-cleaned — every paste leaves a file. Sweep it manually when it gets big:
Remove-Item $env:USERPROFILE\.claude\clipboard-images\*.png/paste doesn't appear in the autocomplete list
Restart Claude Code. Custom slash commands in ~/.claude/commands/ are loaded only at startup.
ERROR: no image in clipboard
You haven't copied an image yet. Take a screenshot first (PrtScn or Win+Shift+S), or copy an image from any app, then run /paste again.
ERROR: failed to save PNG: Access to the path ... is denied
The folder ~/.claude/clipboard-images/ isn't writable. Check your Claude config directory permissions.
Execution policy error
The installer uses -ExecutionPolicy Bypass for that single invocation, so it should never trigger. If it does:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedThe image looks wrong / has weird colors
Some apps put non-bitmap formats on the clipboard (e.g. metafiles). The script only handles raster images. Copy the screenshot through Win+Shift+S (which always produces a PNG-compatible bitmap) and try again.
Remove-Item $env:USERPROFILE\.claude\commands\paste.md
Remove-Item $env:USERPROFILE\.claude\scripts\paste-clipboard-image.ps1
Remove-Item $env:USERPROFILE\.claude\clipboard-images\ -Recurse -ForceRestart Claude Code.
Bugs, ideas, and PRs welcome — especially:
- macOS port (
pngpaste) - Linux port (
xclip/wl-paste) - Auto-cleanup of old PNGs
- Multiple-image clipboard handling
Open an issue or send a PR.
MIT — do whatever you want, no warranty.