Skip to content

Commit 6cc5fe8

Browse files
author
Nguyen Tran
committed
Add admin permissions when non-admin doesn't work
1 parent c55edca commit 6cc5fe8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Collections.Generic;
34
using System.Diagnostics;
45
using System.Linq;
@@ -201,6 +202,21 @@ private static bool DoOpenSettingsAction(WindowsSetting entry)
201202
Process.Start(processStartInfo);
202203
return true;
203204
}
205+
catch (Win32Exception)
206+
{
207+
try
208+
{
209+
processStartInfo.UseShellExecute = true;
210+
processStartInfo.Verb = "runas";
211+
Process.Start(processStartInfo);
212+
return true;
213+
}
214+
catch (Exception exception)
215+
{
216+
Log.Exception("can't open settings on elevated permission", exception, typeof(ResultHelper));
217+
return false;
218+
}
219+
}
204220
catch (Exception exception)
205221
{
206222
Log.Exception("can't open settings", exception, typeof(ResultHelper));

0 commit comments

Comments
 (0)