-2

So I have been trying to figure out how I could make my batch file read stuff from the web and then write it in a text file but can't find any way to do it. So I thought I could ask the people here on stackoverflow since I have had coding problems before and this website and it's users have helped me.

If it's possible to read a website and write the output in a file how would one go about doing such?

H19qjj92
  • 1
  • 1

1 Answers1

1

This seems like something which you may be able to solve with few stackoverflow or google searches, so I will just point you to right direction. Look for Powershell wget and curl commands.

You can redirect the output of those commands using ' > ' operator like in following example.

command (wget or any) someurl > filename.txt

Example:

curl www.google.com > something.txt
Nico Nekoru
  • 2,840
  • 2
  • 17
  • 38
  • 1
    "*Look for Powershell wget and curl commands*," PowerShell does not have `wget`, the `wget` in PowerShell is simply an alias for the command `Invoke-WebRequest` as is `curl` in Powershell. `curl.exe` is present in Windows and differs from `curl` in PowerShell which is just `Invoke-Webrequest`. `curl.exe` can be called from cmd so there is no need for PowerShell in this use case – Nico Nekoru May 07 '21 at 21:33
  • Thanks for a more detailed response. He can definitely use cmd as well. – Priyank Trivedi May 07 '21 at 21:44
  • I understood and I read the stackoverflow question but I still have a question. Can I put this curl command in a batch file? Or perhaps a vbs file? And how would I go about doing that if it was possible? – H19qjj92 May 08 '21 at 00:22
  • @H19qjj92 Sure you can keep it in .bat or .cmd or .btm and execute like how you would execute any batch file. – Priyank Trivedi May 08 '21 at 00:30