# Downlaod file.exe from internet.

**URL:** <https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166>\
**Category:** PowerShell Help\
**Created:** [April 15, 2020, 8:09am UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166 "2020-04-15T08:09:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![breath](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@breath](https://forums.powershell.org/u/breath)\
**Post date:** [April 15, 2020, 8:09am UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166/1 "2020-04-15T08:09:13Z")

</div>

Hi all, I’m new in PowerShell. I’m trying to create a script where I download an exe file.

I found some example from internet and I wrote it, but when I execute my script I receive the following error:

Invoke-WebRequest : Could not find a part of the path 'C:\Users\xxxxxx\Downloads\SW\Download'.  
At line:1 char:1

- Invoke-WebRequest -Uri $url -OutFile $output
- 

```auto

```

- CategoryInfo : NotSpecified: (🙂 [Invoke-WebRequest], DirectoryNotFoundException
- FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

&nbsp;

Could you help me please to understand the error?

&nbsp;

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 15, 2020, 8:16am UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166/2 "2020-04-15T08:16:30Z")

</div>

Antonella, welcome to [Powershell.org](http://Powershell.org). Please take a moment and read the very first post on top of the list of this forum: [Read Me Before Posting! You’ll be Glad You Did!](https://powershell.org/forums/topic/read-me-before-posting-youll-be-glad-you-did/).

When you post code or error messages or sample data or console output format it as code using the code tags “ **PRE** ”, please. Thanks in advance.

It looks like you did not specify a **file** not just a directory for your parameter **-OutFile**.

---

<div class="post-metadata">

**Author:** ![breath](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@breath](https://forums.powershell.org/u/breath)\
**Post date:** [April 15, 2020, 8:25am UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166/3 "2020-04-15T08:25:36Z")

</div>

Thanks,

I haven’t wrote all the script… I write it:

```
$output = "C:\Users\xxxxxxx\Downloads\SW\Download\"
$url	= "https://www.google.com/chrome/"
Invoke-WebRequest -Uri $url -OutFile $output
```

The output I received

```
Invoke-WebRequest : Could not find a part of the path ‘C:\Users\xxxxxx\Downloads\SW\Download\’.
At line:1 char:1
+ Invoke-WebRequest -Uri $url -OutFile $output
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-WebRequest], DirectoryNotFoundException
+ FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 15, 2020, 8:28am UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166/4 "2020-04-15T08:28:24Z")

</div>

> [@](#):
>
> $output = "C:\Users\xxxxxxx\Downloads\SW\Download"

I assume it is a setup file you try to download. You should use something like this:

```
$output = "C:\Users\xxxxxxx\Downloads\SW\Download\setup.exe"
```

It should be a complete path including the file name.

---

<div class="post-metadata">

**Author:** ![breath](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@breath](https://forums.powershell.org/u/breath)\
**Post date:** [April 15, 2020, 8:33am UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166/5 "2020-04-15T08:33:06Z")

</div>

Oh Thanks a lot.

It works! I thought I haven’t to write the exe file name.

Thanks a lot again.

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/downlaod-file-exe-from-internet/14166/6 "2024-05-16T20:29:55Z")

</div>


