Skip to content

Commit 6a8a2df

Browse files
committed
.fix: chage restart explorer method
1 parent d20bdf5 commit 6a8a2df

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

Form1.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class Form1 : Form
2525
private Int16 ModeSlow = 5000;
2626
private Int16 ModeNormarl = 3000;
2727
private Int16 ModeFast = 1000;
28-
private string VERSION = "v0.10.2";
28+
private string VERSION = "v0.10.3";
2929
private string GITHUB = "https://github.com/Fhwang0926/CoreTracker";
3030

3131
private bool mouseDown;
@@ -697,5 +697,6 @@ private bool toggleTraySetting()
697697

698698

699699

700+
700701

701702

Lib/Controller.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,22 +390,23 @@ public void hardwareInfo()
390390
public bool RestartExplorer()
391391
{
392392
try {
393-
exeCmd("taskkill / f / im explorer.exe");
394-
exeCmd("start explorer.exe");
393+
exeCmd("taskkill /F /IM explorer.exe", true);
394+
exeCmd("start /B explorer.exe");
395395
return true;
396396
} catch (Exception e) { Console.WriteLine(e.ToString()); return false; }
397397

398398
}
399399

400-
public bool exeCmd(string cmd)
400+
public bool exeCmd(string cmd, bool isAdmin = false)
401401
{
402402
try
403403
{
404404
Process p = new Process();
405405
p.StartInfo.FileName = "cmd.exe";
406-
p.StartInfo.Arguments = @"/C " + cmd;
406+
p.StartInfo.Arguments = "/C " + cmd;
407407
p.StartInfo.RedirectStandardOutput = false;
408408
p.StartInfo.UseShellExecute = false;
409+
if (isAdmin) { p.StartInfo.Verb = "runas"; }
409410
p.Start();
410411
p.WaitForExit();
411412
return true;

installer/restart_explorer.bat

Lines changed: 0 additions & 4 deletions
This file was deleted.

installer/sample.nsi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ Section "MainSection" SEC01
8888
File "installer\_uninstall.bat"
8989
File "installer\CoreTrackerHelper.x32.exe"
9090
File "installer\CoreTrackerHelper.x64.exe"
91-
File "installer\restart_explorer.bat"
9291
File "README.md"
9392
CreateDirectory "$SMPROGRAMS\CoreTracker"
9493
CreateShortCut "$SMPROGRAMS\CoreTracker\CoreTracker.lnk" "$INSTDIR\CoreTracker.exe"
@@ -144,7 +143,6 @@ Section Uninstall
144143
Delete "$INSTDIR\NULL"
145144
Delete "$INSTDIR\CoreTrackerHelper.x32.exe"
146145
Delete "$INSTDIR\CoreTrackerHelper.x64.exe"
147-
Delete "$INSTDIR\restart_explorer.bat"
148146

149147
Delete "$SMPROGRAMS\CoreTracker\Uninstall.lnk"
150148
Delete "$SMPROGRAMS\CoreTracker\Website.lnk"

0 commit comments

Comments
 (0)