common helper for execute shell process from run plugins (#9538)

This commit is contained in:
Davide Giacometti
2021-02-23 09:53:08 +01:00
committed by GitHub
parent 20a922ce21
commit 571bceb386
17 changed files with 77 additions and 128 deletions

View File

@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using Microsoft.PowerToys.Run.Plugin.Registry.Classes;
using Microsoft.PowerToys.Run.Plugin.Registry.Constants;
@@ -144,21 +143,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
// it's impossible to directly open a key via command-line option, so we must override the last remember key
Win32.Registry.SetValue(@"HKEY_Current_User\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit", "LastKey", fullKey);
var processStartInfo = new ProcessStartInfo
{
// -m => allow multi-instance (hidden start option)
Arguments = "-m",
FileName = "regedit.exe",
// Start as administrator
Verb = "runas",
// Start as administrator will not work without this
UseShellExecute = true,
};
Process.Start(processStartInfo);
// -m => allow multi-instance (hidden start option)
Wox.Infrastructure.Helper.OpenInShell("regedit.exe", "-m", null, true);
}
/// <summary>