From 6072b135e828351ade26e9bfbf1dacbc0818dbe5 Mon Sep 17 00:00:00 2001 From: fofolee Date: Wed, 27 Mar 2019 21:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=B3=E9=94=AE=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E8=BF=9B=E7=A8=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 47 ++++++++++++++++++++++++++++++----------------- preload.js | 8 ++++++-- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 9a2ee79..27dbd19 100644 --- a/index.html +++ b/index.html @@ -14,18 +14,23 @@
diff --git a/preload.js b/preload.js index 4658a0f..7a8f861 100644 --- a/preload.js +++ b/preload.js @@ -51,8 +51,12 @@ tasklist = (callback) => { }); } -taskkill = (taskname, callback) => { - let ps = new PowerShell(`chcp 65001;Stop-Process -Name ${taskname}`); +taskkill = (taskname, taskpath, callback) => { + if (taskpath == undefined) { + var ps = new PowerShell(`chcp 65001;Stop-Process -Name ${taskname}`); + } else { + var ps = new PowerShell(`chcp 65001;Stop-Process -Name ${taskname};Start-Process -FilePath "${taskpath}"`); + } ps.on("error-output", data => { callback(data.split('\n')[0]) });