Last active
March 16, 2024 14:26
-
-
Save r4dian/47c60f43fcfc68059cbe to your computer and use it in GitHub Desktop.
Upload to transfer.sh from Powershell
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
function transfer ($filename) | |
{ | |
$file = Get-Item $filename; | |
invoke-webrequest -method put -infile $file.FullName https://transfer.sh | |
} | |
"Test" | Set-Content .\test.txt | |
transfer(".\test.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've added the short filename as "$($file.Name)" and write link to the file to stdout:
PS C:\tmp> "Test" | Set-Content .\test.txt
PS C:\tmp> transfer.sh .\test.txt
https://transfer.sh/2k60s/test.txt
PS C:\tmp>