WizardKit/.bin/Scripts/safemode_exit.py

40 lines
1,006 B
Python

# Wizard Kit: Exit SafeMode by editing the BCD
import os
import sys
# Init
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
from functions.safemode import *
init_global_vars()
os.system('title {}: SafeMode Tool'.format(KIT_NAME_FULL))
if __name__ == '__main__':
try:
clear_screen()
print_info('{}: SafeMode Tool\n'.format(KIT_NAME_FULL))
other_results = {
'Error': {'CalledProcessError': 'Unknown Error'},
'Warning': {}}
if not ask('Disable booting to SafeMode?'):
abort()
# Configure SafeMode
try_and_print(message='Remove BCD option...',
function=disable_safemode, other_results=other_results)
try_and_print(message='Disable MSI in SafeMode...',
function=disable_safemode_msi, other_results=other_results)
# Done
print_standard('\nDone.')
pause('Press Enter to reboot...')
reboot()
exit_script()
except SystemExit:
pass
except:
major_exception()
# vim: sts=2 sw=2 ts=2