Created
June 26, 2020 00:39
-
-
Save Tiberriver256/d8ee82398827423c35ea4066be532f44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Copy files using your clipboard and PowerShell | |
.DESCRIPTION | |
The file specified at $Path is converted to a base64 string, wrapped with a tiny script that converts the base64 string | |
back to binary and saves it at the path specified in the $Destination parameter | |
#> | |
function Copy-PasteItem { | |
[CmdletBinding()] | |
param ( | |
# The path of the file you would like to copy | |
[string]$Path, | |
# The destination file path you would like the file created | |
[string]Destination | |
) | |
$Base64File = [System.Convert]::ToBase64String((Get-Content -Path $Path -Encoding Byte -ReadCount 0)) | |
"[System.Convert]::FromBase64String('$Base64File') | Set-Content '$Destination' -Encoding Byte -Verbose; Write-Host 'Your file is ready at $Destination'" | clip | |
Write-Host "Open Powershell on the remote computer and paste to create your file at $Destination" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment