1
This commit is contained in:
parent
fea1968317
commit
7cbe310fed
52
change.py
52
change.py
@ -1,6 +1,50 @@
|
||||
import os
|
||||
import ctypes
|
||||
import sys
|
||||
import os
|
||||
from time import sleep
|
||||
|
||||
print("请选择模式")
|
||||
print("1.改为csso 2.改回原版")
|
||||
ip = input('>>>')
|
||||
path = os.getcwd()
|
||||
t = False
|
||||
print(path)
|
||||
|
||||
def exit1():
|
||||
sys.exit()
|
||||
|
||||
def is_admin():
|
||||
# 检查当前是否有管理员权限
|
||||
try:
|
||||
return ctypes.windll.shell32.IsUserAnAdmin()
|
||||
except:
|
||||
return False
|
||||
|
||||
if is_admin():
|
||||
# 如果已经是管理员,执行主要的逻辑
|
||||
while t==False:
|
||||
print("已获得管理员权限")
|
||||
print("请选择模式")
|
||||
print("1.改为csso 2.改回原版 3.退出")
|
||||
ip = input(int('>>>'))
|
||||
|
||||
# 逻辑系统bin2为csso文件 bin1为cs原版文件 bin为现在使用的游戏文件
|
||||
if ip == 1:
|
||||
os.system(f"ren {path}/bin {path}/bin1")
|
||||
os.system(f"ren {path}/bin2 {path}/bin")
|
||||
print("完成!")
|
||||
sleep(1.85)
|
||||
exit1()
|
||||
elif ip == 2:
|
||||
os.system(f"ren {path}/bin {path}/bin2")
|
||||
os.system(f"ren {path}/bin1 {path}/bin")
|
||||
print("完成!")
|
||||
sleep(1.55)
|
||||
exit1()
|
||||
elif ip == 3:
|
||||
sys.exit()
|
||||
else:
|
||||
print("输入错误!")
|
||||
|
||||
else:
|
||||
# 如果没有管理员权限,重新以管理员权限运行脚本
|
||||
print("请求管理员权限...")
|
||||
# 使用 `ctypes` 模块提升权限,重新运行脚本
|
||||
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
|
Loading…
x
Reference in New Issue
Block a user