-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install-ChocolateyShortcut - Don't create a folder if environment variable is used #1687
Comments
I'm not really sure I understand this one so forgive me if I've missed something.
This won't happen. Why can't you use |
@pauby I exactly don't want it to understand. I want And again, the shortcut is good. It is generated as I expected. I just want to correct the behavior of folder-creation. |
This will allow environment variables in shortcut working directory. Environment variables will be kept in shortcut file, and be expanded by Windows in runtime. This is useful when creating Start-menu items for multi-user system.
@pauby This is what gets saved verbatim in the shortcut link, then Windows expands it when you access the .lnk file. It can't be a PowerShell variable because it uses cmd.exe to run. |
@ferventcoder “Up For Grabs”? I thought we already have #1686? |
This will allow environment variables in shortcut working directory. Environment variables will be kept in shortcut file, and be expanded by Windows in runtime. This is useful when creating Start-menu items for multi-user system.
* pr1686: (GH-1687) Allow env var in shortcut working dir
* stable: (GH-1687) Allow env var in shortcut working dir
This will be released with 0.10.12. |
@FranklinYu yes we do, the up for grabs label is what we add for community contributions whether or not there was an existing PR. Something you can ignore, it's not something we later remove. 👍 |
What You Are Seeing?
New folder
%MyVar%
appears in current directory when installing package withInstall-ChocolateyShortcut
.What is Expected?
This folder does not appear, because in runtime the folder will be expanded with value of environment variable
MyVar
instead of verbatim%MyVar%
.How Did You Get This To Happen? (Steps to Reproduce)
Create a package with
choco new
.In
chocolateyInstall.ps1
, add following statement:Pack the package with
choco pack
.Install the package.
Possible Cause
Install-ChocolateyShortcut
automatically created the folder for working directory is the folder is missing. This is an (undocumented) feature.When there is variable in it (such as
%AppData%
), Windows will not set the working directory to a folder named%AppData%
in current directory. Instead, it will try to expand the variable, and set the result as working directory, at runtime. User can change the working directory by changing the environment variable, without changing the shortcut file itself. This is useful in multi-user environment, where each user has different%AppData%
. Current helper creates the shortcut just well, so a small modification will be sufficient to support this pattern.Output Log
(Omitted.)
The text was updated successfully, but these errors were encountered: