# Help with argument containing space

**URL:** <https://forums.powershell.org/t/help-with-argument-containing-space/19481>\
**Category:** PowerShell Help\
**Created:** [May 31, 2022, 11:24am UTC](https://forums.powershell.org/t/help-with-argument-containing-space/19481 "2022-05-31T11:24:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lansti](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@lansti](https://forums.powershell.org/u/lansti)\
**Post date:** [May 31, 2022, 11:24am UTC](https://forums.powershell.org/t/help-with-argument-containing-space/19481/1 "2022-05-31T11:24:09Z")

</div>

Hi, I’m working on a script, where i need to import userprofiles from a profile archive to be terminated, to a new profile area during login. This will be running as a logon task with Horizon Vmware DEM.

This Script works, because there is no space in chrome.zip:

```auto
$ProfArchPath = @()
$ProfArchPath = (Get-ItemPropertyValue -Path 'HKCU:\Software\Policies\Immidio\Flex Profiles\Arguments' -Name 'ProfileArchivePath') + "\Applications\Chrome.zip"
$PathToFlex = "C:\Program Files\Immidio\Flex Profiles"

try {
Start-Process "FlexEngine.Exe" -WorkingDirectory $PathToFlex -ArgumentList " -r $ProfArchPath"
}
catch
{
Write-Warning $Error[0]
}

```

But when i want to import Mozilla Firefox profile with a space before .zip, with this script:

```auto
$ProfArchPath = @()
$ProfArchPath = (Get-ItemPropertyValue -Path 'HKCU:\Software\Policies\Immidio\Flex Profiles\Arguments' -Name 'ProfileArchivePath') + "\Applications\Mozilla Firefox.zip"
$PathToFlex = "C:\Program Files\Immidio\Flex Profiles"

try {
Start-Process "FlexEngine.Exe" -WorkingDirectory $PathToFlex -ArgumentList " -r $ProfArchPath"
}
catch
{
Write-Warning $Error[0]
}

```

i get this error message:

![Error](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/9/913f75661453afc010d55e3f70083f39dd69e044.png)

Any idea?

---

<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:** [May 31, 2022, 11:46am UTC](https://forums.powershell.org/t/help-with-argument-containing-space/19481/2 "2022-05-31T11:46:16Z")

</div>

Stian,  
Welcome to the forum. 👋🏽

> [@lansti](#):
>
> Any idea?

Use single quotes for `$ProfArchPath` in your `-ArgumentList`.

---

<div class="post-metadata">

**Author:** ![lansti](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@lansti](https://forums.powershell.org/u/lansti)\
**Post date:** [June 1, 2022, 8:17am UTC](https://forums.powershell.org/t/help-with-argument-containing-space/19481/3 "2022-06-01T08:17:01Z")

</div>

Well, i tried this:

```auto
Start-Process "FlexEngine.Exe" -WorkingDirectory $PathToFlex -ArgumentList ' -r '$ProfArchPath' '

```

Outcome was:  
WARNING: A positional parameter cannot be found that accepts argument ‘\server\profile$\username\Archives\Applications\Mozilla Firefox.zip’

---

<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:** [June 1, 2022, 9:28am UTC](https://forums.powershell.org/t/help-with-argument-containing-space/19481/4 "2022-06-01T09:28:34Z")

</div>

I recommended to use single quotes only for the path - not for the `-ArgumentList` itself and especially not for both. 😉

---

<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:17pm UTC](https://forums.powershell.org/t/help-with-argument-containing-space/19481/5 "2024-05-16T20:17:52Z")

</div>

Closed on May 16, 2024, 8:17pm UTC


