Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
</RegistryKey>
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\openpwsh\command">
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -WorkingDirectory &quot;%V&quot; -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'&quot;"/>
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -RemoveWorkingDirectoryTrailingCharacter -WorkingDirectory &quot;%V!&quot; -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'&quot;"/>
</RegistryKey>
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuElevatedDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
<RegistryValue Type="string" Value="" Name="HasLUAShield"/>
</RegistryKey>
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas\command">
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -WorkingDirectory &quot;%V&quot; -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'&quot;"/>
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -RemoveWorkingDirectoryTrailingCharacter -WorkingDirectory &quot;%V!&quot; -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'&quot;"/>
</RegistryKey>
</Component>
</Directory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ internal class CommandLineParameterParser
"command",
"settingsfile",
"help",
"workingdirectory"
"workingdirectory",
"removeworkingdirectorytrailingcharacter"
};

internal CommandLineParameterParser(PSHostUserInterface hostUI, string bannerText, string helpText)
Expand Down Expand Up @@ -401,8 +402,24 @@ internal bool NonInteractive

internal string WorkingDirectory
{
get { return _workingDirectory; }
get
{
#if !UNIX
if (_removeWorkingDirectoryTrailingCharacter && _workingDirectory.Length > 0)
{
return _workingDirectory.Remove(_workingDirectory.Length - 1);
}
#endif
return _workingDirectory;
}
}

#if !UNIX
internal bool RemoveWorkingDirectoryTrailingCharacter
{
get { return _removeWorkingDirectoryTrailingCharacter; }
}
#endif

#endregion Internal properties

Expand Down Expand Up @@ -934,6 +951,12 @@ private void ParseHelper(string[] args)

_workingDirectory = args[i];
}
#if !UNIX
else if (MatchSwitch(switchKey, "removeworkingdirectorytrailingcharacter", "removeworkingdirectorytrailingcharacter"))
{
_removeWorkingDirectoryTrailingCharacter = true;
}
#endif
else
{
// The first parameter we fail to recognize marks the beginning of the file string.
Expand Down Expand Up @@ -1364,6 +1387,10 @@ private bool CollectArgs(string[] args, ref int i)
private string _file;
private string _executionPolicy;
private string _workingDirectory;

#if !UNIX
private bool _removeWorkingDirectoryTrailingCharacter = false;
#endif
}
} // namespace