diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 index 446eb516f3..9af7438d00 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 @@ -45,6 +45,9 @@ The full absolute path to the target for new shortcut. OPTIONAL - The full absolute path of the Working Directory that will be used by the new shortcut. +As of v0.10.12, the directory will be created unless it contains environment +variable expansion like `%AppData%\FooBar`. + .PARAMETER Arguments OPTIONAL - Additonal arguments that should be passed along to the new shortcut. @@ -164,7 +167,7 @@ Install-ChocolateyPinnedTaskBarItem } if ($workingDirectory) { - if (!(Test-Path($workingDirectory))) { + if ($workingDirectory -notmatch '%\w+%' -and !(Test-Path($workingDirectory))) { [System.IO.Directory]::CreateDirectory($workingDirectory) | Out-Null } }