0

I have been trying to download files in windows powershell with many commands

Invoke-WebRequest 'https://www.7-zip.org/a/7z2201-x64.exe' -OutFile 'C:\Users\Nati'

and this was the error

The term 'Invoke-WebRequest' is not recognized as the name of a cmdlet, function, script file, or op
ck the spelling of the name, or if a path was included, verify that the path is correct and try agai
At line:1 char:18
+ Invoke-WebRequest <<<<  'https://www.7-zip.org/a/7z2201-x64.exe' -OutFile 'C:\Users\Nati\Documents
    + CategoryInfo          : ObjectNotFound: (Invoke-WebRequest:String) [], CommandNotFoundExceptio
    + FullyQualifiedErrorId : CommandNotFoundException

Any Ideas about it?

I tried the Invoke-Request method and i thought it would be able to install

stackprotector
  • 10,498
  • 4
  • 35
  • 64
c-19
  • 1

1 Answers1

0

You need to specify an actual file in -OutFile and not a directory.
But as stated in the comments, Invoke-WebRequest is only part of PowerShell 3.0 and later.
See MS Learn - Invoke-WebRequest

Invoke-WebRequest 'https://www.7-zip.org/a/7z2201-x64.exe' `
    -OutFile 'C:\Users\Nati\7z2201-x64.exe'
Dennis
  • 871
  • 9
  • 29