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 {
|
||||
if (!_initedPowershell) {
|
||||
var result = await Process.run(
|
||||
'cmd',
|
||||
'powershell',
|
||||
[
|
||||
'/C',
|
||||
'powershell',
|
||||
'-Command',
|
||||
'Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned'
|
||||
],
|
||||
|
|
@ -231,8 +229,8 @@ class ProcessExecutor {
|
|||
|
||||
await initPowershell();
|
||||
try {
|
||||
processData.process = await Process.start('cmd',
|
||||
['/C', 'powershell', '-NoProfile', '-File', file.absolute.path]);
|
||||
processData.process = await Process.start(
|
||||
'powershell', ['-NoProfile', '-File', file.absolute.path]);
|
||||
} on Exception catch (e) {
|
||||
logHandler ?? (e, LogType.error);
|
||||
}
|
||||
|
|
@ -293,8 +291,8 @@ class ProcessExecutor {
|
|||
await initPowershell();
|
||||
|
||||
processResult = await Process.run(
|
||||
'cmd', // PowerShell 실행
|
||||
['/C', 'powershell', '-NoProfile', '-File', file.absolute.path],
|
||||
'powershell', // PowerShell 실행
|
||||
['-NoProfile', '-File', file.absolute.path],
|
||||
runInShell: true);
|
||||
|
||||
file.deleteSync();
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ Exit
|
|||
Future<bool> isRegistedStartup(String label) async {
|
||||
await ProcessExecutor.initPowershell();
|
||||
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;
|
||||
if (process.exitCode == 0) {
|
||||
var existLine = <String>[];
|
||||
|
|
@ -390,7 +390,7 @@ Exit
|
|||
|
||||
await ProcessExecutor.initPowershell();
|
||||
var process = await Process.run(
|
||||
'cmd', ['/C', 'powershell', '-Command', powershellCommand, '-Wait']);
|
||||
'powershell', ['-Command', powershellCommand, '-Wait']);
|
||||
|
||||
print(process.stdout.toString());
|
||||
print(process.stderr.toString());
|
||||
|
|
@ -406,10 +406,8 @@ Exit
|
|||
await ProcessExecutor.initPowershell();
|
||||
var shell = 'Unregister-ScheduledTask -TaskName "$label" -Confirm:\$false';
|
||||
var process = await Process.run(
|
||||
'cmd',
|
||||
'powershell',
|
||||
[
|
||||
'/C',
|
||||
'powershell',
|
||||
'-Command',
|
||||
'Start-Process powershell -ArgumentList \'-NoProfile -ExecutionPolicy Bypass -Command "$shell"\' -Verb RunAs -WindowStyle Hidden'
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue