3,040
个编辑
MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
无编辑摘要 |
小 (格式好了…… // Edit via Wikiplus) |
||
| 第9行: | 第9行: | ||
< | <pre>#Python 3.8.0 | ||
#-*- coding:utf-8 -*- | #-*- coding:utf-8 -*- | ||
#导出模块 | #导出模块 | ||
| 第17行: | 第17行: | ||
#定义一堆函数 | #定义一堆函数 | ||
def cls(): | def cls(): | ||
import os | import os | ||
import sys | |||
import sys | f_handler=open('out.log', 'w') | ||
oldstdout = sys.stdout | |||
f_handler=open('out.log', 'w') | sys.stdout=f_handler | ||
os.system('cls') | |||
oldstdout = sys.stdout | sys.stdout = oldstdout | ||
sys.stdout=f_handler | |||
os.system('cls') | |||
sys.stdout = oldstdout | |||
def msg(): | def msg(): | ||
msg = input("[input]请输入消息:") | msg = input("[input]请输入消息:") | ||
print(msg) | print(msg) | ||
def openurl(): | def openurl(): | ||
url = input("[input]请输入要打开的网页URL:") | url = input("[input]请输入要打开的网页URL:") | ||
webbrowser.open(url) | webbrowser.open(url) | ||
print("已打开网页", url) | print("已打开网页", url) | ||
def printversion(): | def printversion(): | ||
print("Version:", version_number) | print("Version:", version_number) | ||
def openexe(): | def openexe(): | ||
flie = input("请输入要打开的可执行文件名:") | flie = input("请输入要打开的可执行文件名:") | ||
if flie == "": | if flie == "": | ||
print("[ERROR]FlieError:文件名错误") | print("[ERROR]FlieError:文件名错误") | ||
else: | else: | ||
print("已打开可执行文件", flie) | print("已打开可执行文件", flie) | ||
os.system(flie) | os.system(flie) | ||
def shlmsg(): | def shlmsg(): | ||
user32 = windll.LoadLibrary('user32.dll') | user32 = windll.LoadLibrary('user32.dll') | ||
shellmsg = input("请输入要使用 Python Shell 显示的消息:") | shellmsg = input("请输入要使用 Python Shell 显示的消息:") | ||
print("已使用 Python Shell 显示消息", shellmsg) | print("已使用 Python Shell 显示消息", shellmsg) | ||
user32.MessageBoxA(0, str.encode(shellmsg), str.encode('Python Shell'), 0) | user32.MessageBoxA(0, str.encode(shellmsg), str.encode('Python Shell'), 0) | ||
def restart(): | def restart(): | ||
python = sys.executable | python = sys.executable | ||
#显示欢迎语句 | #显示欢迎语句 | ||
print("欢迎使用pycmd!") | print("欢迎使用pycmd!") | ||
printversion() | printversion() | ||
#控制台主循环 | #控制台主循环 | ||
while True: | |||
while True: | |||
choose = input("Pycmd_Admin>") | choose = input("Pycmd_Admin>") | ||
if choose == "^Z": | if choose == "^Z": | ||
sys.exit() | sys.exit() | ||
elif choose == "exit()": | elif choose == "exit()": | ||
sys.exit() | sys.exit() | ||
elif choose == "exit": | elif choose == "exit": | ||
print("[ERROR]SyntaxError:'exit'已弃用,请使用'exit()'") | print("[ERROR]SyntaxError:'exit'已弃用,请使用'exit()'") | ||
elif choose == "msg": | elif choose == "msg": | ||
msg() | msg() | ||
elif choose == "cls": | elif choose == "cls": | ||
cls() | cls() | ||
elif choose == "url": | elif choose == "url": | ||
openurl() | openurl() | ||
elif choose == "version": | elif choose == "version": | ||
printversion() | printversion() | ||
elif choose == "exe": | elif choose == "exe": | ||
openexe() | openexe() | ||
elif choose == "shlmsg": | elif choose == "shlmsg": | ||
shlmsg() | shlmsg() | ||
elif choose == "cmd": | elif choose == "cmd": | ||
print("已打开 cmd ") | print("已打开 cmd ") | ||
os.system("cmd") | os.system("cmd") | ||
elif choose == "powershell": | elif choose == "powershell": | ||
print("已打开 PowerShell") | print("已打开 PowerShell") | ||
os.system("PowerShell") | os.system("PowerShell") | ||
elif choose == "python": | elif choose == "python": | ||
print("已打开 Python") | print("已打开 Python") | ||
os.system("python") | os.system("python") | ||
elif choose == "reset": | elif choose == "reset": | ||
restart() | restart() | ||
elif choose == "explorer": | elif choose == "explorer": | ||
os.system("explorer") | os.system("explorer") | ||
print("已打开 文件资源管理器") | print("已打开 文件资源管理器") | ||
elif choose == "": | elif choose == "": | ||
continue | continue | ||
else: | else: | ||
print("[ERROR]SyntaxError:未知的命令:'" + choose + "'") | print("[ERROR]SyntaxError:未知的命令:'" + choose + "'") | ||
</ | </pre> | ||
('''艹!!!!!'''源代码炸了!!!) | ('''艹!!!!!'''源代码炸了!!!) | ||
==程序可执行文件== | ==程序可执行文件== | ||
个编辑