Skip to content

Instantly share code, notes, and snippets.

Last active September 29, 2020 06:30
What would you like to do?
Upload to from Powershell
function transfer ($filename)
$file = Get-Item $filename;
invoke-webrequest -method put -infile $file.FullName
"Test" | Set-Content .\test.txt
Copy link

t0nik0 commented Dec 14, 2019

I've added the short filename as "$($file.Name)" and write link to the file to stdout:

function ($filename)
  $file = Get-Item $filename;
  (Invoke-WebRequest -Method PUT -InFile $file.FullName -Uri$($file.Name)).Content

PS C:\tmp> "Test" | Set-Content .\test.txt
PS C:\tmp> .\test.txt
PS C:\tmp>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment