Skip to content

Instantly share code, notes, and snippets.

@Mohammad-Reihani
Created July 28, 2025 20:51
Show Gist options
  • Save Mohammad-Reihani/0894d67a2f8999de5bac69f18cf5f563 to your computer and use it in GitHub Desktop.
Save Mohammad-Reihani/0894d67a2f8999de5bac69f18cf5f563 to your computer and use it in GitHub Desktop.
ssh-copy-id in Powershell and cmd

Powershell

type $env:USERPROFILE\.ssh\yourkey.pub | ssh user@ipaddress  "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

CMD

type %USERPROFILE%\.ssh\id_ed25519_tunnel.pub | ssh user@host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment