update exe powershell
This commit is contained in:
parent
26111e223e
commit
d0cdcd438d
2 changed files with 8 additions and 12 deletions
|
|
@ -131,10 +131,8 @@ class ProcessExecutor {
|
||||||
static Future initPowershell() async {
|
static Future initPowershell() async {
|
||||||
if (!_initedPowershell) {
|
if (!_initedPowershell) {
|
||||||
var result = await Process.run(
|
var result = await Process.run(
|
||||||
'cmd',
|
'powershell',
|
||||||
[
|
[
|
||||||
'/C',
|
|
||||||
'powershell',
|
|
||||||
'-Command',
|
'-Command',
|
||||||
'Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned'
|
'Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned'
|
||||||
],
|
],
|
||||||
|
|
@ -231,8 +229,8 @@ class ProcessExecutor {
|
||||||
|
|
||||||
await initPowershell();
|
await initPowershell();
|
||||||
try {
|
try {
|
||||||
processData.process = await Process.start('cmd',
|
processData.process = await Process.start(
|
||||||
['/C', 'powershell', '-NoProfile', '-File', file.absolute.path]);
|
'powershell', ['-NoProfile', '-File', file.absolute.path]);
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
logHandler ?? (e, LogType.error);
|
logHandler ?? (e, LogType.error);
|
||||||
}
|
}
|
||||||
|
|
@ -293,8 +291,8 @@ class ProcessExecutor {
|
||||||
await initPowershell();
|
await initPowershell();
|
||||||
|
|
||||||
processResult = await Process.run(
|
processResult = await Process.run(
|
||||||
'cmd', // PowerShell 실행
|
'powershell', // PowerShell 실행
|
||||||
['/C', 'powershell', '-NoProfile', '-File', file.absolute.path],
|
['-NoProfile', '-File', file.absolute.path],
|
||||||
runInShell: true);
|
runInShell: true);
|
||||||
|
|
||||||
file.deleteSync();
|
file.deleteSync();
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ Exit
|
||||||
Future<bool> isRegistedStartup(String label) async {
|
Future<bool> isRegistedStartup(String label) async {
|
||||||
await ProcessExecutor.initPowershell();
|
await ProcessExecutor.initPowershell();
|
||||||
var shell = 'Get-ScheduledTask | Where-Object {\$_.TaskName -eq "$label"}';
|
var shell = 'Get-ScheduledTask | Where-Object {\$_.TaskName -eq "$label"}';
|
||||||
var process = await Process.run('cmd', ['/C', 'powershell', shell]);
|
var process = await Process.run('powershell', [shell]);
|
||||||
var exist = false;
|
var exist = false;
|
||||||
if (process.exitCode == 0) {
|
if (process.exitCode == 0) {
|
||||||
var existLine = <String>[];
|
var existLine = <String>[];
|
||||||
|
|
@ -390,7 +390,7 @@ Exit
|
||||||
|
|
||||||
await ProcessExecutor.initPowershell();
|
await ProcessExecutor.initPowershell();
|
||||||
var process = await Process.run(
|
var process = await Process.run(
|
||||||
'cmd', ['/C', 'powershell', '-Command', powershellCommand, '-Wait']);
|
'powershell', ['-Command', powershellCommand, '-Wait']);
|
||||||
|
|
||||||
print(process.stdout.toString());
|
print(process.stdout.toString());
|
||||||
print(process.stderr.toString());
|
print(process.stderr.toString());
|
||||||
|
|
@ -406,10 +406,8 @@ Exit
|
||||||
await ProcessExecutor.initPowershell();
|
await ProcessExecutor.initPowershell();
|
||||||
var shell = 'Unregister-ScheduledTask -TaskName "$label" -Confirm:\$false';
|
var shell = 'Unregister-ScheduledTask -TaskName "$label" -Confirm:\$false';
|
||||||
var process = await Process.run(
|
var process = await Process.run(
|
||||||
'cmd',
|
'powershell',
|
||||||
[
|
[
|
||||||
'/C',
|
|
||||||
'powershell',
|
|
||||||
'-Command',
|
'-Command',
|
||||||
'Start-Process powershell -ArgumentList \'-NoProfile -ExecutionPolicy Bypass -Command "$shell"\' -Verb RunAs -WindowStyle Hidden'
|
'Start-Process powershell -ArgumentList \'-NoProfile -ExecutionPolicy Bypass -Command "$shell"\' -Verb RunAs -WindowStyle Hidden'
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue