mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Adds script to patch the shortcut working directory to the user's home folder. (#6043)
Update the shortcut created by the installer to use %HOMEDRIVE%%HOMEPATH% for the working directory.
This commit is contained in:
@@ -43,6 +43,18 @@
|
|||||||
<!-- Default value of Checkbox of starting PowerShell after installation -->
|
<!-- Default value of Checkbox of starting PowerShell after installation -->
|
||||||
<Property Id="WixShellExecTarget" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
|
<Property Id="WixShellExecTarget" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
|
||||||
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
|
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
|
||||||
|
<CustomAction Id="SaveShortcutPath" Property="ShortcutPath" Value="[$ApplicationProgramsMenuShortcut]$(var.ProductSemanticVersionWithNameAndOptionalArchitecture).lnk" />
|
||||||
|
<CustomAction Id="FixShortcutWorkingDirectory" Script="vbscript" HideTarget="no" Impersonate="no">
|
||||||
|
shortcutPath = Session.Property("ShortcutPath")
|
||||||
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||||
|
if (fso.FileExists(shortcutPath)) Then
|
||||||
|
Set wshShell = CreateObject("WSCript.Shell")
|
||||||
|
Set shortcut = wshShell.CreateShortcut(shortcutPath)
|
||||||
|
|
||||||
|
shortcut.workingdirectory = "%HOMEDRIVE%%HOMEPATH%"
|
||||||
|
shortcut.save
|
||||||
|
End If
|
||||||
|
</CustomAction>
|
||||||
<UI>
|
<UI>
|
||||||
<Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
|
<Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
|
||||||
<Control Id="LaunchCheckBox" Type="CheckBox" X="10" Y="243" Width="170" Height="17" Property="LAUNCHAPPONEXIT" Hidden="yes" CheckBoxValue="1" Text="Launch $(env.ProductName)">
|
<Control Id="LaunchCheckBox" Type="CheckBox" X="10" Y="243" Width="170" Height="17" Property="LAUNCHAPPONEXIT" Hidden="yes" CheckBoxValue="1" Text="Launch $(env.ProductName)">
|
||||||
@@ -185,6 +197,12 @@
|
|||||||
</Directory>
|
</Directory>
|
||||||
</Directory>
|
</Directory>
|
||||||
</Directory>
|
</Directory>
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action="SaveShortcutPath" After="InstallFinalize" />
|
||||||
|
<Custom Action="FixShortcutWorkingDirectory" After="SaveShortcutPath">
|
||||||
|
NOT Installed OR NOT REMOVE OR UPGRADINGPRODUCTCODE
|
||||||
|
</Custom>
|
||||||
|
</InstallExecuteSequence>
|
||||||
</Product>
|
</Product>
|
||||||
|
|
||||||
<!-- Explorer Context Menu Dialog -->
|
<!-- Explorer Context Menu Dialog -->
|
||||||
|
|||||||
Reference in New Issue
Block a user