Repository navigation
Installer should start PS Core with user's home dir as the working dir #5705
Description
Activity
- addedWG-Maintainers-Buildspecific to affecting the buildspecific to affecting the buildIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bug
on Dec 17, 2017 bergmeister commented
on Jan 4, 2018 ContributorMore actionsKeith 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 commented
on Jan 4, 2018 CollaboratorAuthorMore actionsTry changing the
Directory="INSTALLFOLDER"attribute. Hopefully WiX has a predefined variable for the user's home dir.rkeithhill commented
on Jan 4, 2018 CollaboratorAuthorMore actionsLooks 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 commented
on Jan 4, 2018 ContributorMore actionsThanks for the pointers. I am struggling to get a valid syntax that Wix accepts at the moment but will come back to it tomorrow.
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.Looks like this isn't actually fixed. Working on a PR.
Reacted by Christoph Bergmeister- removedResolution-FixedThe issue is fixed.The issue is fixed.
on Jun 14, 2018 rkeithhill commented
on Jun 14, 2018 CollaboratorAuthorMore actionsYup, just noticed that.
bergmeister commented
on Jun 14, 2018 ContributorMore actionsThe new
-WorkingDirectoryparameter 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
-WorkingDirectoryparameter, but the work to actually add that was missed. I'll have a PR submitted shortly.Reacted by Christoph Bergmeister- added a commit that references this issue
on Jun 20, 2018 - added a commit that references this issue
on Aug 6, 2026
Steps to reproduce
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