I downloaded a large file, using wget which is just alias for Invoke-WebRequest commandlet in powershell, and it asked me url i provided, it completed, and gave me the Headers of HTTP request instead of saving file or anything ? I dont have access to the url anymore ?

Can i get that file back, my powershell session is still not closed, tough I have ran some commands in it already ? can i access that object where the content is actually stored ? My plan is to get that object back and then execute something on it to save the content into a file

1 Answer 1


If you run invoke-webrequest (or the alias wget) without the -outfile parameter specified, rather than saving the file to disk, it will output the content of the file directly in the console.

If you used this on a textfile, such as plain-text or html, you can scroll up, select the text, and copy it to a new file. Keep in mind that the output will warp around to the nextline, and you manually have to remove the incorrect ones.

If the file is binary, and you see weird characters, it is going to be impossible to use the output of the file.

That said, given the session is still active, you can press the up-arrow at the console line to get previously entered commands. Press it enough times to get your wget command back and it should also contain the url again. If you now add the -outfile parameter with a valid path, you can actually redownload the file and save it to disk this time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .