You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Installer should start PS Core with user's home dir as the working dir #5705
Install PS Core rc2 and at the select check the box to start PowerShell.
Find PowerShell Core in the task bar, right-click it and select "Pin to taskbar"
Expected behavior
PowerShell Core as started by the installer, starts in my home dir.
PowerShell Core as started by the taskbar icon, starts in my home dir.
Actual behavior
PowerShell Core in both cases starts in C:\Program Files\PowerShell\6.0.0-rc.2.
I wind up having to edit the taskbar shortcut's properties to change the "Start in:" location to %USERPROFILE% - which works but I shouldn't have to do this. I suspect other folks will use the PS Core started by the installer as the easy means to get PS Core pinned to their taskbar.
If the installer could set the working dir to the current user's home dir before launching PowerShell, that would probably fix both scenarios.
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 6.0.0-rc.2
PSEdition Core
GitCommitId v6.0.0-rc.2
OS Microsoft Windows 10.0.16299
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Keith Hill (@rkeithhill) My branch here has modified the installer to launch PowerShell when having ticked the checkbox as pwsh.exe -NoExit -Command Set-Location $env:HOME. However, if I then right-click on the shell and pin it to the taskbar, the Start in is still the installation location of pwsh.
The last time I looked into this, I couldn't find a way to get this to work because the environment variables get resolved at install time, not runtime. Also tried to escape the string so it shows up as literally %USERPROFILE% in the shortcut, but Wix doesn't allow it.
The new -WorkingDirectory parameter should make it possible to overcome WiX's syntax limitations. One can already configure a shortcut manually after installation.
Christoph Bergmeister (@bergmeister) yeah, I think what happened is that Ilya (@iSazonov) made a fix, but we reverted it planning on using the new -WorkingDirectory parameter, but the work to actually add that was missed. I'll have a PR submitted shortly.
Activity
bergmeister commentedon Jan 4, 2018
Keith Hill (@rkeithhill) My branch here has modified the installer to launch PowerShell when having ticked the checkbox as
pwsh.exe -NoExit -Command Set-Location $env:HOME. However, if I then right-click on the shell and pin it to the taskbar, theStart inis still the installation location of pwsh.rkeithhill commentedon Jan 4, 2018
Try changing the
Directory="INSTALLFOLDER"attribute. Hopefully WiX has a predefined variable for the user's home dir.rkeithhill commentedon Jan 4, 2018
Looks like you can use either
[%USERPROFILE]or[%HOMEDRIVE][%HOMEPATH]. See https://stackoverflow.com/questions/9635813/how-can-i-reference-the-users-home-directory-in-wix The last answer has a number of WiX steps that you might need to follow.bergmeister commentedon Jan 4, 2018
Thanks for the pointers. I am struggling to get a valid syntax that Wix accepts at the moment but will come back to it tomorrow.
SteveL-MSFT commentedon Jan 5, 2018
The last time I looked into this, I couldn't find a way to get this to work because the environment variables get resolved at install time, not runtime. Also tried to escape the string so it shows up as literally
%USERPROFILE%in the shortcut, but Wix doesn't allow it.SteveL-MSFT commentedon Jun 14, 2018
Looks like this isn't actually fixed. Working on a PR.
rkeithhill commentedon Jun 14, 2018
Yup, just noticed that.
bergmeister commentedon Jun 14, 2018
The new
-WorkingDirectoryparameter should make it possible to overcome WiX's syntax limitations. One can already configure a shortcut manually after installation.SteveL-MSFT commentedon Jun 14, 2018
Christoph Bergmeister (@bergmeister) yeah, I think what happened is that Ilya (@iSazonov) made a fix, but we reverted it planning on using the new
-WorkingDirectoryparameter, but the work to actually add that was missed. I'll have a PR submitted shortly.When installing using MSI, set the working directory of the shortcut …
When installing using MSI, set the working directory of the shortcut …