mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 11:24:46 +08:00
使用新的方法申请UAC
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:starcitizen_doctor/common/conf.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||
|
||||
class SystemHelper {
|
||||
@ -179,4 +180,24 @@ foreach ($adapter in $adapterMemory) {
|
||||
} catch (_) {}
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
static initVBS() async {
|
||||
final script = '''
|
||||
If Not WScript.Arguments.Named.Exists("elevate") Then
|
||||
CreateObject("Shell.Application").ShellExecute WScript.FullName _
|
||||
, """" & WScript.ScriptFullName & """ /elevate", "", "runas", 1
|
||||
WScript.Quit
|
||||
End If
|
||||
|
||||
Set WshShell = WScript.CreateObject("WScript.Shell")
|
||||
exeName = """${Platform.resolvedExecutable}"""
|
||||
statusCode = WshShell.Run(exeName, 1, true)
|
||||
''';
|
||||
final vbsFile = File(AppConf.launchHelperPath);
|
||||
if (await vbsFile.exists()) {
|
||||
await vbsFile.delete();
|
||||
}
|
||||
await vbsFile.create();
|
||||
await vbsFile.writeAsString(script);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user