用户:钻石ew666/沙盒/Pycmd:修订间差异

格式好了…… // Edit via Wikiplus
无编辑摘要
(格式好了…… // Edit via Wikiplus)
 
 
<nowikipre>#Python 3.8.0
#-*- coding:utf-8 -*-
#导出模块
#定义一堆函数
def cls():
import os
import sys
f_handler=open('out.log', 'w')
import sys
oldstdout = sys.stdout
sys.stdout=f_handler
f_handler=open('out.log', 'w')
os.system('cls')
oldstdout = sys.stdout = oldstdout
sys.stdout=f_handler
os.system('cls')
sys.stdout = oldstdout
 
def msg():
 
msg = input("[input]请输入消息:")
 
print(msg)
def openurl():
 
url = input("[input]请输入要打开的网页URL:")
 
webbrowser.open(url)
 
print("已打开网页", url)
 
def printversion():
 
print("Version:", version_number)
 
def openexe():
 
flie = input("请输入要打开的可执行文件名:")
 
if flie == "":
 
print("[ERROR]FlieError:文件名错误")
 
else:
 
print("已打开可执行文件", flie)
 
os.system(flie)
 
def shlmsg():
 
user32 = windll.LoadLibrary('user32.dll')
 
shellmsg = input("请输入要使用 Python Shell 显示的消息:")
 
print("已使用 Python Shell 显示消息", shellmsg)
 
user32.MessageBoxA(0, str.encode(shellmsg), str.encode('Python Shell'), 0)
 
def restart():
 
python = sys.executable
 
#显示欢迎语句
 
print("欢迎使用pycmd!")
 
printversion()
 
#控制台主循环
while True:
 
while True:
choose = input("Pycmd_Admin>")
 
if choose == "^Z":
 
sys.exit()
 
elif choose == "exit()":
 
sys.exit()
 
elif choose == "exit":
 
print("[ERROR]SyntaxError:'exit'已弃用,请使用'exit()'")
 
elif choose == "msg":
 
msg()
 
elif choose == "cls":
 
cls()
 
elif choose == "url":
 
openurl()
 
elif choose == "version":
 
printversion()
 
elif choose == "exe":
 
openexe()
 
elif choose == "shlmsg":
 
shlmsg()
 
elif choose == "cmd":
 
print("已打开 cmd ")
 
os.system("cmd")
 
elif choose == "powershell":
 
print("已打开 PowerShell")
 
os.system("PowerShell")
 
elif choose == "python":
 
print("已打开 Python")
 
os.system("python")
 
elif choose == "reset":
 
restart()
 
elif choose == "explorer":
 
os.system("explorer")
 
print("已打开 文件资源管理器")
 
elif choose == "":
 
continue
 
else:
 
print("[ERROR]SyntaxError:未知的命令:'" + choose + "'")
 
</nowikipre>
 
('''艹!!!!!'''源代码炸了!!!)
 
 
==程序可执行文件==
优秀编辑者、​管理员
3,005

个编辑