mirror of
https://github.com/JDM170/win_update_script
synced 2025-12-10 05:57:17 +07:00
Added round to elapsed time
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
27
main.py
27
main.py
@@ -110,7 +110,7 @@ w11_apps = [
|
|||||||
# "Microsoft.Paint", # Paint (W11)
|
# "Microsoft.Paint", # Paint (W11)
|
||||||
"Microsoft.PowerAutomateDesktop", # (W11)
|
"Microsoft.PowerAutomateDesktop", # (W11)
|
||||||
"Microsoft.Todos", # (W11)
|
"Microsoft.Todos", # (W11)
|
||||||
"MicrosoftTeams", # Teams (W11)
|
# "MicrosoftTeams", # Teams (W11)
|
||||||
"MicrosoftWindows.Client.WebExperience", # Виджеты (W11)
|
"MicrosoftWindows.Client.WebExperience", # Виджеты (W11)
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -157,29 +157,14 @@ def main():
|
|||||||
# Start process
|
# Start process
|
||||||
time_start = time()
|
time_start = time()
|
||||||
appslist = convert_applist_to_string(is_w11)
|
appslist = convert_applist_to_string(is_w11)
|
||||||
with open(ps_script_path, mode="w") as f: # Create powershell script file
|
|
||||||
wim = properties.get("wim").get("path")
|
wim = properties.get("wim").get("path")
|
||||||
mnt = properties.get("mnt").get("path")
|
mnt = properties.get("mnt").get("path")
|
||||||
f.write(ps_script_raw.format(
|
with open(ps_script_path, mode="w") as f: # Create powershell script file
|
||||||
appslist=appslist,
|
f.write(ps_script_raw.format(appslist=appslist, wimpath=wim, mntpath=mnt, updpath=properties.get("upd").get("path")))
|
||||||
wimpath=wim,
|
|
||||||
mntpath=mnt,
|
|
||||||
updpath=properties.get("upd").get("path")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if additional_upd and exists(additional_upd):
|
if additional_upd and exists(additional_upd):
|
||||||
f.write(ps_script_additional.format(
|
f.write(ps_script_additional.format(wimpath=wim, mntpath=mnt, sec_updpath=additional_upd))
|
||||||
wimpath=wim,
|
|
||||||
mntpath=mnt,
|
|
||||||
sec_updpath=additional_upd
|
|
||||||
)
|
|
||||||
)
|
|
||||||
with open(bat_script_path, mode="w") as f: # Create bat script file
|
with open(bat_script_path, mode="w") as f: # Create bat script file
|
||||||
f.write(bat_script_raw.format(
|
f.write(bat_script_raw.format(mntpath=mnt, wimpath=wim))
|
||||||
mntpath=properties.get("mnt").get("path"),
|
|
||||||
wimpath=properties.get("wim").get("path")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# subprocess.Popen("powershell Unblock-File -Path {}".format(ps_script_path)).wait()
|
# subprocess.Popen("powershell Unblock-File -Path {}".format(ps_script_path)).wait()
|
||||||
subprocess.Popen("powershell {}".format(ps_script_path)).wait()
|
subprocess.Popen("powershell {}".format(ps_script_path)).wait()
|
||||||
subprocess.Popen("{}".format(bat_script_path)).wait()
|
subprocess.Popen("{}".format(bat_script_path)).wait()
|
||||||
@@ -187,7 +172,7 @@ def main():
|
|||||||
properties.get("mnt")["path"] = ""
|
properties.get("mnt")["path"] = ""
|
||||||
properties.get("upd")["path"] = ""
|
properties.get("upd")["path"] = ""
|
||||||
do_cleanup()
|
do_cleanup()
|
||||||
print("Затраченное время:", ((time()-time_start) / 60))
|
print("Затраченное время:", round((time()-time_start) / 60))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user